in src/android/CameraLauncher.java [888:963]
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Get src and dest types from request code for a Camera Activity
int srcType = (requestCode / 16) - 1;
int destType = (requestCode % 16) - 1;
// If Camera Crop
if (requestCode >= CROP_CAMERA) {
if (resultCode == Activity.RESULT_OK) {
// Because of the inability to pass through multiple intents, this hack will allow us
// to pass arcane codes back.
destType = requestCode - CROP_CAMERA;
try {
processResultFromCamera(destType, intent);
} catch (IOException e) {
e.printStackTrace();
LOG.e(LOG_TAG, "Unable to write to file");
}
}// If cancelled
else if (resultCode == Activity.RESULT_CANCELED) {
this.failPicture("No Image Selected");
}
// If something else
else {
this.failPicture("Did not complete!");
}
}
// If CAMERA
else if (srcType == CAMERA) {
// If image available
if (resultCode == Activity.RESULT_OK) {
try {
if (this.allowEdit) {
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
applicationId + ".cordova.plugin.camera.provider",
createCaptureFile(this.encodingType));
performCrop(tmpFile, destType, intent);
} else {
this.processResultFromCamera(destType, intent);
}
} catch (IOException e) {
e.printStackTrace();
this.failPicture("Error capturing image: "+e.getLocalizedMessage());
}
}
// If cancelled
else if (resultCode == Activity.RESULT_CANCELED) {
this.failPicture("No Image Selected");
}
// If something else
else {
this.failPicture("Did not complete!");
}
}
// If retrieving photo from library
else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
if (resultCode == Activity.RESULT_OK && intent != null) {
final Intent i = intent;
final int finalDestType = destType;
cordova.getThreadPool().execute(new Runnable() {
public void run() {
processResultFromGallery(finalDestType, i);
}
});
} else if (resultCode == Activity.RESULT_CANCELED) {
this.failPicture("No Image Selected");
} else {
this.failPicture("Selection did not complete!");
}
}
}