[英]navigator.camera.getPicture doesn’t call success callback - ionic framework - cordova
I am using navigator.camera for taking pictrues. 我正在使用navigator.camera拍摄照片。 The success and error call back is not getting called most of the time. 大多数时候都没有调用成功和错误回调。 I have installed cordova camera plugin 我已经安装了cordova相机插件
I am using 我在用
ionic 1.2.8 离子1.2.8
cordova 3.5.0-0.2.7 科尔多瓦3.5.0-0.2.7
org.apache.cordova.camera 0.3.3 "Camera" org.apache.cordova.camera 0.3.3“相机”
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 PhoneGap相机重启应用程序
How to prevent Android to restart application after calling camera intent? 调用相机意图后如何防止Android重启应用程序?
Cordova / Samsung Galaxy SIII - Camera Crashes app 科尔多瓦/三星Galaxy SIII - 相机崩溃应用程序
Phonegap camera android kills cordova Phonegap相机android杀死了cordova
Cordova plugin callback received after second plugin call 第二次插件调用后收到Cordova插件回调
Posting this here so that this will help someone else. 在此发布此内容,这将有助于其他人。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.