通过H5+方式下载 :plus.downloader.createDownload,生成下载任务对象(downloadTask),通过downloadTask.addEventListener("statechanged",(task,status)=>{})监听下载进度 5.下载完自动安装 通过H5+ plus.runtime.install实现自动安装,该api只能监听是否打开安装页面,无法监测到apk是否安装成功,还需要调用安卓原生注册广播事件...
}) 方法2:用【plus.downloader.createDownload】进行下载,之后更新 vardtask = plus.downloader.createDownload( "https://golfdev-s3static.s3.ap-northeast-1.amazonaws.com/tebleorder.apk", {},function( d, status ) {//下载完成if( status == 200) { plus.runtime.install(plus.io.convertLocalFileSys...
plus.runtime.install( path, { force: true }, function() { plus.nativeUI.closeWaiting(); plus.nativeUI.alert('应用资源更新完成!', function() { plus.runtime.restart(); // 重启APP }); }, function(e) { plus.nativeUI.closeWaiting(); } ); }, 強更新 1 2 3 4 5 6 7 8 9 10 11...
runtime.install(plus.io.convertLocalFileSystemURL(d .filename), {}, {}, function(error) { uni.showToast({ title: '安装失败', duration: 1500 }); }) } else { uni.showToast({ title: '更新失败', duration: 1500 }); } }); dtask.start(); // 下载任务开始下载 // 关于进度的获取是...
问题描述 uni.downloadFile({ url: res.installUrl, success: (downloadResult) => { if (downloadResult.statusCode === 200) { plus.runtime.install(downloadResult.tempFilePath, { force: false }, function() { plus.runtime.restart(); }, function(e) ...
plus.runtime.install(updated.packgePath, { force: true }); uni.setStorage({ key: 'updated', data: { completed: true, packgePath: updated.packgePath }, success: res => { console.log('成功安装上次的更新,应用需要重启才能继续完成'); ...
"appid": plus.runtime.appid, "version": plus.runtime.version, "name":plus.os.name } 响应数据: { "status":1, // 升级标志,0:无需更新 1:整包更新 2 热更新; "note": "修复bug1", // 更新描述 "url": "http://www.example.com/uniapp.apk" //更新包下载地址 ...
("path:" + d.filename); plus.runtime.install(path); // 安装下载的apk文件 } else {//下载失败 alert( "Download failed: " + status ); } plus.nativeUI.closeWaiting(); }); dtask.start(); } //版本升级:实现通知栏显示下载进度 const downloadApkAndShowProgressForUpdate = function(url){...
downloadPackage = () => {const task = plus.downloader.createDownload(this.downloadUrl, {},(res, status) => {if (status === 200) {plus.runtime.install(res.filename)}})task.start()}复制代码 下载进度提示 为了友好的用户体验,可以显示下载进度,这里就简单暴露一个进度属性progress出来,实际场景可...
function installFile(file) { if (plus) { uni.showLoading({ title: "文件安装中...", }); plus.runtime.install( file, { force: true, }, (res) => { uni.hideLoading(); checkInfo.showProgress = false; checkInfo.currentProgress = 0; proxy.$apis.utils.storeage({ type: "set", isSyn...