Cordova version is: 6.3.0
Cordova Android version is: 5.0.0
Camera Plugin version: cordova-plugin-camera 2.2.0 "Camera"
My code works on multiple devices with Android 5.0 and Android 6.0 but it does not working on Android 4.4, Android 4,3 etc.
In Android 4.4 and 4.3 camera plugin triggers both camera and library but it does not get into .then(function(ImageData){..} it goes into error function.
$scope.gallery = function() {
var options = {
quality : 80,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit : false,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
targetWidth: 500,
targetHeight: 500,
saveToPhotoAlbum: true,
correctOrientation: true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
console.log('image');
imaged = imageData;
$scope.statusMessagePhoto = "photo saved ✓";
}, function(error) {
console.log(error.message);
alert(error.message);
});
};
$scope.savephoto = function(){
var options = {
quality : 80,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
targetWidth: 500,
targetHeight: 500,
saveToPhotoAlbum: true,
correctOrientation: true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
imaged = imageData;
$scope.statusMessagePhoto = "photo saved ✓";
} , function(error) {
console.log(error.message);
alert(error.message);
});
};
When i press savephoto button camera opens, but in console (log) i get the error "undefined" and the alert too, before even save or choose the photo i want.
Have anyone experienced the same error on Android 4.3 or 4.4. I repeat the code works perfect on Android 5.0 and above.