首页 > 解决方案 > Android上的Camera Cordova插件问题

问题描述

我的应用程序使用 ionic 1 和cordova-camera-plugin。它在 ios 上运行良好。但是在 android 上它第一次要求相机权限然后应用程序崩溃,然后当我再次尝试时,我收到以下错误: file:///storage/emulated/0/Android/data/com.company.test/cache/ .Pic.jpg 通过 ClipData.Item.getUri() 暴露在应用程序之外

我有任何帮助..请在下面找到我的代码:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    var cameraOptions = {
            quality: 100,
            targetWidth: 400,
            targetHeight: 400,
            destinationType: Camera.DestinationType.DATA_URL,
            correctOrientation: true
    };
       navigator.camera.getPicture(cameraSuccess, cameraError, cameraOptions);

}

 function cameraSuccess(imageURI){
     $scope.$apply(function () {
        //some code
     });
 }

 //here is where i am getting the error 
 function cameraError(message)
 {
    console.log(message);
   //alert('Failed because: ' + message);
 }

标签: androidangularjscordovaionic-frameworkcordova-plugins

解决方案


推荐阅读