PhoneGap 2.5.0 Camera and Gallery crashing

1,275 views
Skip to first unread message

John Saya

unread,
Mar 12, 2013, 12:41:02 PM3/12/13
to phon...@googlegroups.com
In the past I know older versions of Android have issues handling memory when using the camera and gallery, but now testing PhoneGap 2.5.0 on a Samsung Charge running Android 2.3.6, the app crashes every time using either the camera or gallery.  But it runs perfectly fine on a Samsung Galaxy S3.

Here's the stack trace:

java.lang.RuntimeException: Unable to resume activity {com.myapp.app/com.myapp.app.HelloPhoneGapActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/14 }} to activity {com.myapp.app/com.myapp.app.HelloPhoneGapActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2124)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1672)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/14 }} to activity {com.myapp.app/com.myapp.app.HelloPhoneGapActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2111)
... 12 more
Caused by: java.lang.NullPointerException
at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:849)
at android.app.Activity.dispatchActivityResult(Activity.java:3908)
at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
... 13 more


Any thoughts?

Thanks

John

Don

unread,
Mar 13, 2013, 5:01:29 PM3/13/13
to phon...@googlegroups.com
The purpose of our application is to take many pictures and then save them up to our API using AJAX. It seems we can take more pictures by reducing the quality of the images taken in the camera application. The smaller the image, the longer it takes to encounter the error. We've got the camera set to take VGA quality pictures and can get in approx 30 images before the application will crash, versus 8-10 at full 5M resolution. Here is how we are making the call to getPicture():

navigator.camera.getPicture(
function(imageUri) {
// our success function
}, 
function(message) {
// our fail function
}, 
quality: 100,
destinationType: Camera.DestinationType.FILE_URI ,
correctOrientation: false 
}
);

We were trying suggestions from this Simon MacDonald blog post (http://simonmacdonald.blogspot.ca/2012/07/change-to-camera-code-in-phonegap-190.html) to try to manage our memory footprint (ie- quality: 100, no fixedWidth/Height, no correctOrientation) but that doesn't seem to correct the issue. If anything we can take more pictures before the app crashes.

Again, we are only seeming to have this issue with the Nexus 10 tablet on 4.2.2, not the less powerful XYBoard 10.1 on 4.0.2.


Don

unread,
Mar 29, 2013, 2:18:59 PM3/29/13
to phon...@googlegroups.com
To follow-up, we never figured out a solution using the default camera. We implemented the Foreground Camera plugin to keep our app from being killed in the background.

John Saya

unread,
Mar 29, 2013, 2:26:19 PM3/29/13
to phon...@googlegroups.com
Hey Don,

Thanks for the follow up.  We've done the same thing but downgraded to 2.4.0 to implement the foreground camera.  However, what we've noticed so far is it no longer allows you to access the gallery on a device and you lose the ability to use your phone's camera flash, zoom features, etc...  Have you experienced any of that?

John

Don

unread,
Apr 1, 2013, 8:18:56 AM4/1/13
to phon...@googlegroups.com
Yes- besides turning on auto-flash, we don't have access to any of the camera controls. I suppose you could probably modify the plugin to meet your needs, but it actually works fine for us as-is.

Don
Reply all
Reply to author
Forward
0 new messages