美文网首页
mui 安卓版app更新提示(热更新)

mui 安卓版app更新提示(热更新)

作者: 多多VS串串 | 来源:发表于2017-12-11 18:13 被阅读0次
var server = localStorage.getItem('deviceurl') + "PosSellSearch!update_app.do";
// 获取本地应用资源版本号 
var wgtVer=null;
function plusReady(){ // 获取本地应用资源版本号             
    plus.runtime.getProperty(plus.runtime.appid,function(inf){
                   wgtVer=inf.version;
                     alert(wgtVer);
    });
}

var ver;
mui.plusReady(function(){
        plus.runtime.getProperty(plus.runtime.appid, function(inf) {
                    ver = inf.version;
                     var client;
                     var ua = navigator.userAgent.toLowerCase();
                     $.ajax({
                               type:"get",
                                dataType:'jsonp',
                                url:server,//获取当前上架APPStore版本信息
                                success:function(data){
                                          var ver_new = (data.version).replace(/\./g,'');
                                           var ver_used = ver.replace(/\./g,'');
                                           if (ver_new > ver_used) {
                                                        alert('发现新版本'+ data.version + "是否更新");
                                                         plus.runtime.openURL(data.url);
                                            }
                                },
                               error: function(xhr, type, errerThrown) {
                                        mui.toast('网络异常,请稍候再试');
                                }
                     });
        })
})

相关文章

网友评论

      本文标题:mui 安卓版app更新提示(热更新)

      本文链接:https://www.haomeiwen.com/subject/apcwixtx.html