T.R*_*mer 5 android apk cordova
我们正在开发一个PhoneGap应用程序,并希望在新版本可用时提供新apk文件的链接.
例如:
<a href="http://myserver.com/myapp.apk">Download</a>
Run Code Online (Sandbox Code Playgroud)
它是一个内部应用程序,所以我们不能把它放在Android市场上.它在PhoneGap 1.5上运行良好,但在升级到1.9版之后就停止了工作.如果你点击链接没有任何反应.
我已经将我们的服务器添加到cordova.xml(<access origin="http://myserver.com"/>也尝试过<access origin="*"/>)并在AndroidManifest.xml中获得了权限INSTALL_PACKAGES
有谁知道我错过了什么?这是权限问题吗?
Abd*_*DDN -1
使用此功能在phonegap中下载文件
function downloadFile(){
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getFile(
"dummy.html", {create: true, exclusive: false},
function gotFileEntry(fileEntry) {
var sPath = fileEntry.fullPath.replace("dummy.html","");
var fileTransfer = new FileTransfer();
fileEntry.remove();
fileTransfer.download(
"http://www.w3.org/2011/web-apps-ws/papers/Nitobi.pdf",
sPath + "theFile.pdf",
function(theFile) {
console.log("download complete: " + theFile.toURI());
showLink(theFile.toURI());
},
function(error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code: " + error.code);
}
);
}, fail);
}, fail);
};
Run Code Online (Sandbox Code Playgroud)
}
| 归档时间: |
|
| 查看次数: |
2398 次 |
| 最近记录: |