cordova网络情况检测插件使用:cordova-plugin-network-information

1.  添加插件 : cordova plugin add cordova-plugin-network-information

2. 调用方法:

document.addEventListener('deviceready',function(){
    //获取网络的信息;
     var type = navigator.connection.type;
   if (type === 'wifi') {
     $CommonFactory.showConfirm(function(){UpdateForAndroid();},"版本升级","发现新版本","升级","取消");  
     }else{
     $CommonFactory.showConfirm(function(){UpdateForAndroid();},"建议您在WIFI条件下进行升级,是否确认升级?","发现新版本","升级","取消");
   }
},false);
原文地址:https://www.cnblogs.com/liaolei1/p/7639880.html