简体   繁体   English

navigator.camera.getPicture不会调用成功回调 - 离子框架 - cordova

[英]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.

相关问题 PhoneGap navigator.camera.getPicture不触发回调 - PhoneGap navigator.camera.getPicture don't trigger Callback cordova navigator.camera.getPicture 在 android 中不起作用 - cordova navigator.camera.getPicture not working in android Cordova 3.4.0 navigator.camera.getPicture不会为Android 4.3回调onSuccess或onFail - Cordova 3.4.0 navigator.camera.getPicture does not callback onSuccess or onFail for Android 4.3 为什么我不能在Android应用中使用Cordova 2.7.0触发navigator.camera.getPicture? - Why can't I trigger navigator.camera.getPicture using Cordova 2.7.0 in my Android app? ionic navigator.camera.getPicture不会从PHOTOLIBRARY返回图像 - ionic navigator.camera.getPicture won't return image from PHOTOLIBRARY navigator.camera.getPicture无法正常工作 - navigator.camera.getPicture not working properly navigator.camera.getPicture在android中不起作用 - navigator.camera.getPicture not working in android Cordova navigator.camera.getPicture在Android 4.4 KitKat上以意外格式返回FILE_URI - Cordova navigator.camera.getPicture returns FILE_URI in unexpected format on Android 4.4 KitKat from gallery 画廊错误中的navigator.camera.getPicture错误“无法创建位图” - navigator.camera.getPicture from the gallery error “Unable to create bitmap” navigator.camera.getPicture不打开设备的默认相机应用程序 - navigator.camera.getPicture dont opens the device's default camera application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM