问题
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