navigator.camera.getPicture不调用成功回调 - 离子框架 - cordova [英] navigator.camera.getPicture doesn’t call success callback - ionic framework - cordova

查看:1443
本文介绍了navigator.camera.getPicture不调用成功回调 - 离子框架 - cordova的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用navigator.camera来拍摄照片。成功和错误回调在大多数时间不被调用。我已安装cordova相机插件

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

我使用

ionic 1.2.8

ionic 1.2.8

cordova 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"

下面是我使用的代码。

$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相机重新启动应用程式

如何防止Android在调用相机意图后重新启动应用程序?

Cordova / Samsung Galaxy SIII - 相机崩溃应用

Phonegap相机android杀死cordova

Cordova plugin callback received after second plugin call

在这里发布,以便这将帮助别人。 :)

Posting this here so that this will help someone else. :)

这篇关于navigator.camera.getPicture不调用成功回调 - 离子框架 - cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆