美文网首页
ionic判断当前网络状态

ionic判断当前网络状态

作者: Android10 | 来源:发表于2016-11-21 21:40 被阅读0次
     /****
             * 当前的连接状态
             */
            var networkState = $cordovaNetwork.getNetwork();
            if(networkState == Connection.NONE){
                alert('没有网络连接');
            } else if(Connection.CELL_2G == networkState || Connection.CELL_3G == networkState || Connection.CELL_4G == networkState){
                alert('使用流量连接');
            } else if(Connection.WIFI == networkState){
                alert('使用wifi连接');
            } else if(Connection.ETHERNET == networkState){
                alert('使用以太网');
            }

相关文章

网友评论

      本文标题:ionic判断当前网络状态

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