当我将相机项目作为USB连接设备进行测试时,一切正常。现在我决定构建应用程序以使用intel xdk生成apk文件。在我的设备上构建并安装apk后,单击相机按钮,不会启动任何事件。 这是我的控制者:
.controller("IController", function($scope, $cordovaCamera) {
$scope.takePicture = function() {
var options = {
quality : 75,
destinationType : Camera.Dest
inationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : false,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 350,
targetHeight: 350,
popoverOptions: CameraPopoverOptions,
correctOrientation: true,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
$scope.imgURI = "data:image/jpeg;base64," + imageData;
}, function(err) {
// An error occured. Show a message to the user
});
}
});
这是我的索引:
<ion-content ng-controller="IController">
<div class="item item-image">
<img ng-show="imgURI !== undefined" ng-src="{{imgURI}}" style="max-width: 40%">
<img ng-show="imgURI === undefined" ng-src="http://placehold.it/300x300" style="max-width: 100%">
</div>
<div class="button-bar">
<button ng-click="takePicture()" class="button icon-left ion-android-camera customIconSound">Take photo</button>
<button ng-click="takePicture()" class="button button-outline icon-right ion-home customIconSound">Gallery!</button>
</div>
</ion-content>
请问我错过了什么。感谢
答案 0 :(得分:0)
在尝试了不同的事情后,我能够使用这种方法解决我的问题。我点击了XDK项目标签,然后点击加号到&#34; 插件&#34;然后点击&#34; 附带的插件&#34;然后检查&#34; 相机&#34;复选框