【问题标题】:navigator.camera.getPicture doesn’t call success callback - ionic framework - cordovanavigator.camera.getPicture 不调用成功回调-离子框架-cordova
【发布时间】:2014-12-10 15:27:55
【问题描述】:

我正在使用 navigator.camera 来拍照。成功和错误回调大部分时间都不会被调用。我已经安装了cordova相机插件

我正在使用

离子 1.2.8

科尔多瓦 3.5.0-0.2.7

org.apache.cordova.camera 0.3.3“相机”

下面显示的是我使用的代码。

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

};

【问题讨论】:

    标签: android cordova camera hybrid-mobile-app ionic


    【解决方案1】:

    当我断开手机与系统的连接时,它开始完美运行。当我的手机处于开发者模式时出现了问题。

    以下是一些链接,可能会帮助其他面临类似问题的人

    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

    在此处发布此内容,以便对其他人有所帮助。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-02
      • 1970-01-01
      • 2016-10-29
      • 2013-11-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多