I am using navigator.camera for taking pictrues. The success and error call back is not getting called most of the time. I have installed cordova camera plugin
I am using
ionic 1.2.8
cordova 3.5.0-0.2.7
org.apache.cordova.camera 0.3.3 "Camera"
Shown below is the code I use.
$scope.takePicture = function takePicture() {
var success = function onSuccess (FILE_URI){
console.log("something" + FILE_URI)
console.log(FILE_URI);
$localstorage.setObject("file",FILE_URI);
$rootScope.picData = FILE_URI;
}
var error = function onError () {
console.log("Error")
alert("error")
}
console.log("Taking picture");
navigator.camera.getPicture(success,error,{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA
});
};
It started working perfectly when I disconnected my phone from my system. Something wrong was happening when my phone was in developer mode.
Given below are few links which might help others facing similar issue
PhoneGap camera restarts the application
How to prevent Android to restart application after calling camera intent?
Cordova / Samsung Galaxy SIII - Camera Crashes app
Phonegap camera android kills cordova
Cordova plugin callback received after second plugin call
Posting this here so that this will help someone else. :)