Cordova 生成后phonegap上载问题
这在通过eclipse的android仿真器上运行良好。当按下上传按钮并要求上传文件时;当phonegap在设备上运行创建apk文件时失败,上载按钮不工作。我还必须删除phonegap.js 摄像机插件是否添加到config.xmlCordova 生成后phonegap上载问题,cordova,Cordova,这在通过eclipse的android仿真器上运行良好。当按下上传按钮并要求上传文件时;当phonegap在设备上运行创建apk文件时失败,上载按钮不工作。我还必须删除phonegap.js 摄像机插件是否添加到config.xml function getImage() { Retrieve image file location from specified source navigator.camera.MediaType.ALLMEDIA
function getImage() {
Retrieve image file location from specified source
navigator.camera.MediaType.ALLMEDIA
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('File Not Selected');
},{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
mediaType: navigator.camera.MediaType.ALLMEDIA
}
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="uploaded";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "abc.php", win, fail, options);
}
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
alert(r.response);
}
function fail(error) {
alert("An error has occurred: Code = " +error.code);
}
你说你必须删除phonegap.js 如果这样做,则无法访问任何设备API,因为它们依赖于应用程序中特定于设备的phonegap.js。这将在PhoneGap构建时注入
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />