navigator.camera.getPicture doesn’t call success c

2019-08-05 03:20发布

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
        });

};

1条回答
Root(大扎)
2楼-- · 2019-08-05 03:43

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. :)

查看更多
登录 后发表回答