Phonegap 2.3.0 and ForegroundCamera Plugin
I am using Phonegap 2.3.0 and the new ForegroundCamera plugin from Google Code .. I followed the instructions closely and in my Eclipse setup I got the following errors when checking out the project:
- Unable to convert from ForegroundCameraLauncher to plugin
- ctx cannot be resolved or is not a field (x2)
- R cannot be resolved by variable (x4)
- Success of (PluginResult, String) undefined method for type ForegroundCameraLauncher
I have now solved the first three of the above errors by updating some legacy lines of code (hopefully I figured it no longer shows errors).
The first bug was fixed by changing the plugin in the CordovaPlugin in the line "import org.apache.cordova.api.Plugin;" in ForegroundCameraLauncher.java. ctx was replaced with cordova.getActivity () in two places where it caused problems. This thing with R was fixed by making some changes to the library that caused it to create an R object (sorry, I don't know how to explain this correctly, since I'm not too experienced with Eclipse yet).
With the last of four error messages, I tried to make an interim fix by commenting out these two lines in ForegroundCameraLauncher.java (lines with "this.success" ...). But when you take a photo in your app, it crashes on everything coming back from the camera instance.
Does anyone know what's going on? I'd really love to get some pointers here :)
The last error is obviously the one you should focus on;) I just wanted to include some of the error correction process in case others were experiencing the same errors.
source to share
Check out this commit to see what changed in Cordova: https://github.com/apache/cordova-android/commit/205215d409c4f75e958a9c09c0b4a38bd9a859ac
Replace this.success(new PluginResult(PluginResult.Status.OK, getRealPathFromURI(uri, this.ctx)), this.callbackId);
with this.callbackContext.success(getRealPathFromURI(uri, cordova));
.
Please execute
update the function according to this commit and update takePicture
.
After this I have a ForgroundCamera plugin working with Cordova 2.3. Now we need to run some more tests and clean up.
source to share
We have just updated the Foreground Camera Plugin to work with Phonegap 2.4.0 , and we are also working on the Gallery Foreground Plugin . See http://code.google.com/p/foreground-camera-plugin/ and http://code.google.com/p/foreground-gallery-plugin/ and let us know (post question) if you have a problem.
See ya!
source to share