Phonegap : Camera Not Working In Android Kitkat
I am developing an App in Android for camera application. I add the camera using cordova plugin config.xml
Solution 1:
You made a mistake inside your code. destinationType: destinationType.FILE_URI,
will not work. Change that line to destinationType: Camera.DestinationType.FILE_URI,
instead and it'll run. Here's your full working code:
functionsnapPicture() {
navigator.camera.getPicture(onSuccess, onFail, { quality: 100,
sourceType: navigator.camera.PictureSourceType.CAMERA,
mediaType: navigator.camera.MediaType.PICTURE,
destinationType: Camera.DestinationType.FILE_URI,
encodingType: navigator.camera.EncodingType.JPEG,
correctOrientation: false,
saveToPhotoAlbum: true
})
//A callback function when snapping picture is success.functiononSuccess (imageData) {
var image = document.getElementById ('picture');
alert("path : "+imageData);
image.src = imageData;
}
//A callback function when snapping picture is fail.functiononFail (message) {
alert ('Error occured: ' + message);
}
}
I recommend you to use GapDebug to Debug your Applications.
Post a Comment for "Phonegap : Camera Not Working In Android Kitkat"