简体   繁体   English

PhoneGap 2.3:Cordova拍摄照片API(camera.getPicture)API返回onDestory

[英]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). 我正在使用Galaxy Tab 3(Android 4.1.2)通过PhoneGap API(版本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. 单击“保存”按钮时,会立即调用DroidGap的“ onDestory()”,因此该活动被杀死。

I have tried on other Android devices such as Samsung Galaxy S4 and there is no such issue. 我曾在其他Android设备(例如Samsung Galaxy S4)上尝试过,但没有此类问题。 It only happens on Galaxy Tab 3 that it only becomes successfully once for ten trials. 只有在Galaxy Tab 3上,它才能成功十次试用一次。

What is the possibility for the "onDestory()" method being called immediately? 立即调用“ onDestory()”方法的可能性是什么?

        // 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 }
                                    );

On the Samsung Galaxy 3 the developer option Do not keep activities is on by default. 在Samsung Galaxy 3上,默认情况下启用了开发人员选项“不保留活动”。

This will garbage collect your main activity when you launch any other, in this case the Camera. 当您启动其他任何活动(在本例中为Camera)时,这将垃圾收集您的主要活动。

Switching off the option solves the problem 关闭该选项可解决问题

Cordova / Samsung Galaxy SIII - Camera Crashes app 科尔多瓦/三星Galaxy SIII-相机崩溃应用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM