document.addEventListener('netchange',onNetChange,false)
function onNetChange(){
var nt = plus.networkinfo.getCurrentType();
switch(nt){
case plus.networkinfo.CONNECTION_ETHERNET:
case plus.networkinfo.CONNECTION_WIFI:
return callback('Wifi')
break;
case plus.networkinfo.CONNECTION_CELL2G:
case plus.networkinfo.CONNECTION_CELL3G:
case plus.networkinfo.CONNECTION_CELL4G:
return callback('2/3/4G')
break;
default:
return callback('no')
mui.toast('请检查您的网络设置')
break;
}
}
网友评论