Camera or Import from Gallery crashes the app


#1

We have an app where you take a photo and share with others via camera or gallery. Whenever we take the photo and confirm after cropping (cam or gallery) it doesnt return to the app but crashes. How can we solve this or at least track where the error is?


#2

can you check the Web Console and System.err log?
adb logcat | grep -i 'Web Console’
adb logcat | grep -i ‘System.err’


#3

I am also getting the same error and the research points to the fact that android closes the app once it leaves to open the camera. There are two plugins but I havent been able to get it to work. I am also desperate to fix this.

https://code.google.com/p/foreground-camera-plugin/


#4

Is this on Android? If so I think it’s a known quirk in the plugin that devices with low memory will crash unexpectedly. I’ve had this happen on a HTC One X, when I have other apps open in the background (consuming memory) and take a photo it will crash almost 100% of the time. If I close all apps, then use the plugin it works 100% of the time so my best guess is memory of the device is low if on Android.

You could also try adjusting the options passed into the camera function be reducing the size of the image and resolution. These are my settings, I reduced the targetHeight/targetWidth from 1080 to 760 and it seems to work more reliably. Try that and let me know if you still have any issues.

   var optionsCamera = {
        quality: 100,
        destinationType: Camera.DestinationType.FILE_URI,
        sourceType: Camera.PictureSourceType.CAMERA,
        allowEdit: true,
        encodingType: Camera.EncodingType.JPEG,
        targetWidth: 760,
        targetHeight: 760,
        saveToPhotoAlbum: false,
        correctOrientation: true
    };