// 创建下载任务
function createDownload(url) {
var dtask = plus.downloader.createDownload( url, {}, function ( download, status ) {
// 下载完成
if ( status == 200 ) {
mui.toast( "下载成功: " + download.filename );
} else{
mui.toast( "下载失败: " + status );
}
});
dtask.start();
}
已下载成功,如何自动安装?
1 个回复
4***@qq.com
if ( status == 200 ) {
mui.toast( "下载成功: " + download.filename );
plus.runtime.install(download.filename ); // 自动安装apk文件
} else{
mui.toast( "下载失败: " + status );
}