For testing purposes I copied the full example found on the phonegap camera API and I put an alert on onPhotoDataSuccess
to test when the function is fired. On the
I had this problem with Cordova 3.7.1 and Camera 0.3.5 - every time I called the plugin, it did not return the image/path and on second call it returned error "Canceled" for the previous call.
The problem was that my main activity had own onActivityResult which did not correctly call the super's method.
public class MainActivity extends CordovaActivity {
//...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == MyCustomActivity) {
doMyCustomActivity(requestCode);
}
}
//...
}
To fix it, I had to add ELSE to call the correct handler:
public class MainActivity extends CordovaActivity {
//...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == MyCustomActivity) {
doMyCustomActivity(requestCode);
}
else { //this was missing - call other Activity of plugins
super.onActivityResult(requestCode, resultCode, intent);
}
}
//...
}