|
本帖最后由 痞子菜 于 2016-12-26 11:16 编辑
function checkUpdate() {
api.showProgress({
style: 'default',
animationType: 'fade',
title: '努力加载中...',
text: '先喝杯茶...',
modal: false
});
var mam = api.require('mam');
mam.checkUpdate(function(ret, err) {
alert( JSON.stringify( ret ) );
// console.log("ret="+JSON.stringify( ret ) +"err="+JSON.stringify( err ) );
if (ret) {
api.hideProgress();
var result = ret.result;
if (result.update == true && result.closed == false) {
var str = '新版本型号:' + result.version + ';更新提示语:' + result.updateTip + ';下载地址:' + result.source + ';发布时间:' + result.time;
api.confirm({
title : '有新的版本,是否下载并安装 ',
msg : str,
buttons : ['确定', '取消']
}, function(ret, err) {
if (ret.buttonIndex == 1) {
if (api.systemType == "android") {
api.download({
url : result.source,
report : true
}, function(ret, err) {
if (ret && 0 == ret.state) {/* 下载进度 */
api.toast({
msg : "正在下载应用" + ret.percent + "%",
duration : 2000
});
}
if (ret && 1 == ret.state) {/* 下载完成 */
var savePath = ret.savePath;
api.installApp({
appUri : savePath
});
}
});
}
if (api.systemType == "ios") {
api.installApp({
appUri : result.source
});
}
}
});
} else {
api.toast({
msg : "暂无更新"
});
}
} else {
api.hideProgress();
api.toast({
msg : err.msg
});
}
});
}
我云编译了新的版本,但是这个检测不出来啊!求各位指教一下为什么?
|
-
-
|