ConnectivityManager cm = (ConnectivityManager) mContext.getApplicationContext().getSystemService(mContext.CONNECTIVITY_SERVICE); NetworkInfo[] nis=cm.getAllNetworkInfo(); for(int i=0;i<nis.length;i++){ //Log.d("UpdateManagerTest", nis[i].getTypeName()+"---"+nis[i].getType()); Log.d("UpdateManagerTest", nis[i].getExtraInfo()); //cm.stopUsingNetworkFeature(nis[i].getType(), nis[i].getTypeName()); } boolean abc=ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_WIFI); assertTrue(abc); boolean bcd=ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE); assertTrue(bcd);
[Android]获取网络连接状态
猜你喜欢
转载自myeyeofjava.iteye.com/blog/1495073
今日推荐
周排行