0
我是科爾多瓦的新手,並試圖開發Android應用程序,我需要打開相機。但我無法做到。以下是我遵循的方法:無法通過科爾多瓦打開相機
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
document.getElementById('camera').addEventListener('click',function(e){
navigator.camera.getPicture(onSuccess, onFail,{
quality: 50,
destinationType: Camera.DestinationType.DATA_URL});})
},
function onSuccess(imageData){
var image=document.getElementById('myImage');
image.src="data:img/jpeg;base64,"+imageData;
}
function onFail(message){
alert('Failed because: '+message);
}
receivedEvent: function(id) {
console.log(id)
}
};
app.initialize();
用Android模擬器構建和打開後相機未打開。請幫助我。在此先感謝