Cordova版本3.6.3-0.2.13
我正在玩代码 Apache Cordova API Cookbook 代码就像:
//Defines the button label for alert dialogs
var btnText = "Continue";
function onBodyLoad() {
//Let the user know we've launched
alert("onBodyLoad");
//Set the Cordova deviceready event listener, so we'll know
//when Cordova is ready
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
console.log("Entering onDeviceReady");
//Let the user know that the deviceReady event has fired
navigator.notification.alert("Cordova is ready", null, "Device Ready", btnText);
console.log("Leaving onDeviceReady");
}
function takePhoto() {
console.log("Entering takePhoto");
navigator.camera.getPicture(cameraSuccess, cameraError);
console.log("Entering takePhoto");
}
function cameraSuccess(imageURL) {
console.log("Entering cameraSuccess");
navigator.notification.alert(imageURL, null, "Photo Results", btnText);
console.log("Leaving cameraSuccess");
}
function cameraError(errObj) {
console.log("Entering cameraError");
console.error(JSON.stringify(errObj));
navigator.notification.alert("Error: " + JSON.stringify(errObj), null, "Camera Error", btnText);
console.log("Leaving cameraError");
}
但是当我跑步时
cordova -d运行android
并且应用程序安装在我的设备中(Samsung Ace android 2.3)
我收到了消息
插入存储卡以使用相机
当然,如果我自己使用相机 它工作并将图片存储在我的画廊
所以我想知道这是什么问题?
更新
如果我拔掉usb电缆就可以了!
答案 0 :(得分:0)
Camera.DestinationType是否搞砸了。
要避免常见内存问题,请将Camera.destinationType设置为FILE_URI而不是DATA_URL