red23jordan
red23jordan

Reputation: 2891

PhoneGap 2.3: Cordova Take Photo API (camera.getPicture) API return onDestory

I am using Galaxy Tab 3 (Android 4.1.2) to take photo by PhoneGap API (version 2.3). After capturing the photo, "Save" and "Discard" button appeared. When "Save" button is clicked, "onDestory()" from DroidGap is being called immediately and thus the Activity is being killed.

I have tried on other Android devices such as Samsung Galaxy S4 and there is no such issue. It only happens on Galaxy Tab 3 that it only becomes successfully once for ten trials.

What is the possibility for the "onDestory()" method being called immediately?

        // Retrieve image file location from specified source
        navigator.camera.getPicture(uploadPhoto,
                                    function(message) { alert('get picture failed'); },
                                    { quality: 50, 
                                    destinationType: navigator.camera.DestinationType.FILE_URI,
                                    sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }
                                    );

Upvotes: 1

Views: 365

Answers (1)

M.Mostafa
M.Mostafa

Reputation: 228

On the Samsung Galaxy 3 the developer option Do not keep activities is on by default.

This will garbage collect your main activity when you launch any other, in this case the Camera.

Switching off the option solves the problem

Cordova / Samsung Galaxy SIII - Camera Crashes app

Upvotes: 1

Related Questions