navigator.camera.getPicture不叫成功回调 - 离子框架 - 科尔多瓦

问题描述:

我使用navigator.camera采取pictrues。成功和错误回调是没有得到所谓的大部分时间。我已经安装了摄像头科尔多瓦插件

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

我使用

离子1.2.8

科尔多瓦3.5.0-0.2.7

cordova 3.5.0-0.2.7

org.apache.cordova.camera 0.3.3照相机

org.apache.cordova.camera 0.3.3 "Camera"

是code我用。

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

};

男人我花了几天的阳光下,但在我的S5棒棒糖画布这乱投医拍照后永远不会更新。然后,我发现了一个网站的这个小宝石。拉他们展现出来onDeviceReady的东西,只是通过它在你的正常功能拍照。哦,定向修复现在可以正确适用时所选择!如果你使用这种方法确保你也抢JavaScript文件,你会通过点击信号源键往上顶,以及所需要的必要的。然后做了必要打针连线了这一切。这个链接是 ngCamera

Man i spent days on this trying everything under the sun but on my S5 with Lollipop the canvas would never update after taking a picture. Then I found this little jewel of a site. Pull the stuff they show out of onDeviceReady and just through it in your normal function to take a picture. Oh, and the orientation fix now properly applies when chosen!!! If you use this approach make sure you also grab the necessary javascript file you'll need by clicking on the source button up top as well. Then do the necessary injections to wire it all up. The link is ngCamera