判断wifi网络是否链接:
代码如下 | 复制代码 |
publicstaticbooleanisWiFiActive(Context inContext) { WifiManager mWifiManager = (WifiManager) inContext .getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); intipAddress = wifiInfo ==null?0: wifiInfo.getIpAddress(); if(mWifiManager.isWifiEnabled() && ipAddress !=0) { System.out.println("**** WIFI is on"); returntrue; }else{ System.out.println("**** WIFI is off"); returnfalse; } } |
判断3G网络是否链接:
代码如下 | 复制代码 |
publicstaticbooleanisNetworkAvailable( Context context) { ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivity ==null) { System.out.println("**** newwork is off"); returnfalse; }else{ NetworkInfo info = connectivity.getActiveNetworkInfo(); if(info ==null){ System.out.println("**** newwork is off"); returnfalse; }else{ if(info.isAvailable()){ System.out.println("**** newwork is on"); returntrue; } } } System.out.println("**** newwork is off"); returnfalse; } |
相关权限:
代码如下 | 复制代码 |
一亿小目标手游
如果让你的人生从来,你可以像王健林一样霸气的表示一亿小目标吗
一亿小目标手机版2019
一亿小目标手机版2019趣味休闲模拟游戏,玩家在游戏中将会通
巴啦啦梦幻餐厅
巴啦啦梦幻餐厅是一款充满魔幻色彩的二次元模拟经营手游,游戏界
恋爱进行时九游版
恋爱进行时九游版是一款以模拟恋爱玩法为核心的角色扮演手游,精
皇室对决fr(Null’s Royale)
皇室对决fr,即皇室战争的私服变态版本,在该版本中玩家能够拥