Error 'Camera Cancelled' - App Sencha with PhoneGap

谁都会走 提交于 2019-12-04 04:28:39

问题


I'm developping an app that you take pictures with phone and send to social networks. My App is developped with sencha touch 2 and Phonegap. When i try take a picture my app restarts and give me a error 'Camera cancelled'. I try see console.logs but they don't appear...

Here's my code:

function uploadPhoto(data){
                // this is where i will send the image file to server
                //output image to screen 
                    console.log(data);
                }
    function fail(msg){
                    alert(msg);
                }
    navigator.camera.getPicture(uploadPhoto, fail, {
                    quality : 30,
                    destinationType: Camera.DestinationType.DATA_URL 
                });</i>

回答1:


Same error here. I'm using cordova v2.6 for Android.

To solve it I had to edit the AndroidManifest.xml and change the DroidGap activity launch mode from "singleInstance" to "standard".




回答2:


I almost got crazy with this.

You must to be pretty sure what options* are you using and passing to $cordovaCamera.getPicture(options*). For example, you'll get failure if you are using saveToPhotoAlbum (true or false), you will get always "camera cancelled" because Android doesnt have this option. Don't use this on your config on android.

Hope it helps!




回答3:


Which version of phonegap are you using? I tried using 2.7.0 here and it works without problems.




回答4:


add this line to the AndroidManifest

<uses-feature android:name="android.hardware.camera.PictureCallback" />


来源:https://stackoverflow.com/questions/16298909/error-camera-cancelled-app-sencha-with-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!