【发布时间】:2016-07-22 18:28:38
【问题描述】:
我正在为我的 Ionic 应用程序使用相机插件。 当我在设备上尝试浏览器应用程序时,相机可以正常工作,但是当我在设备上构建和运行 APK 时,不会触发 getPicture 方法。
$scope.takePictureBack = function () {
$ionicPlatform.ready(function () {
var cameraOptions = {
quality: 100,
targetHeight: 1080,
targetWidth: 1920,
destinationType: Camera.DestinationType.DATA_URL
};
var success = function (data) {
$scope.$apply(function () {
/*
remember to set the image ng-src in $apply,
i tried to set it from outside and it doesn't work.
*/
$scope.cameraPicBack = "data:image/jpeg;base64," + data;
});
};
var failure = function (message) {
};
//call the cordova camera plugin to open the device's camera
navigator.camera.getPicture(success, failure, cameraOptions);
})
};
我尝试过用日志测试,似乎方法的失败回调和成功回调都没有到达。
有谁知道相机插件有什么并发症吗? 作为记录,我的 cordova 和 ionic 已更新,我正在使用 Android 6.0.1 在 Galaxy s6 edge plus 上进行测试。
【问题讨论】:
标签: android cordova ionic-framework build