uni-app写的安卓端,需要差量更新,写完差量更新后,手机端提示下载更新,提示下载成功、安装成功,但是app未做任何改变,APP的版本号也没变,又没有大神能帮忙分析一下?多谢
一下是手机端下载更新代码
plus.runtime.getProperty(req.appId, function(widgetInfo){
req.version=widgetInfo.version
uni.request({
url: server,
data: req,
success: (resUpdate) => {
var result = JSON.parse(resUpdate.data.parameterSet.result);
console.log(JSON.stringify(result));
if(result.status=="1"){
var wgtUrl=result.url;
plus.nativeUI.showWaiting("升级中...");
var dtask = plus.downloader.createDownload( wgtUrl, {method:"GET"}, function(d,status){
if ( status == 200 ) {
//alert("下载wgt成功:" + d.filename);
plus.nativeUI.showWaiting("下载wgt成功:" + d.filename);
plus.nativeUI.showWaiting("安装wgt文件...");
//force: true
plus.runtime.install(d.filename,{},function(){
plus.nativeUI.closeWaiting();
console.log("安装wgt文件成功!");
plus.nativeUI.alert("应用资源更新完成!",function(){
plus.runtime.restart();
});
},function(e){
plus.nativeUI.closeWaiting();
console.log("安装wgt文件失败["+e.code+"]:"+e.message);
plus.nativeUI.alert("安装wgt文件失败["+e.code+"]:"+e.message);
});
} else {
plus.nativeUI.closeWaiting();
plus.nativeUI.showWaiting("下载失败:" + status);
// alert( "Download wgtu failed: " + status );
}
} );
dtask.addEventListener('statechanged',function(d,status){
console.log("statechanged: "+d.state);
});
dtask.start();
}else{
console.log("已是最新版本");
}
}
})
})