mui determines the current network type

mui determines the current network type

MUI judges the current network type and introduces the native api

mui.plusReady(function(){
    
                
//              plus.networkinfo.CONNECTION_UNKNOW = "未知";状态码:0 
//              plus.networkinfo.CONNECTION_NONE = "无网络链接"; 状态码:1
//              plus.networkinfo.CONNECTION_ETHERNET = "有线网络"; 状态码:2
//              plus.networkinfo.CONNECTION_WIFI = "无线网络"; 状态码:3
//              plus.networkinfo.CONNECTION_CELL2G = "蜂窝移动2G网络"; 状态码:4
//              plus.networkinfo.CONNECTION_CELL3G = "蜂窝移动3G网络"; 状态码:5
//              plus.networkinfo.CONNECTION_CELL4G = "蜂窝移动4G网络"; 状态码:6
            if(plus.networkinfo.getCurrentType()!=3){
    
    // 3为状态码,wifi状态码是3
//          
                    mui.toast("正在使用蜂窝移动网络");
            }

Guess you like

Origin blog.csdn.net/qq_37192571/article/details/108982825