标签:
//判断网络类型
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
//判断当前的网络连接类型
NetworkInfo networkInfo
= connectivityManager.getActiveNetworkInfo();
if (!networkInfo.isAvailable())
return;
//获取当前网络的类型
String type = "";
if (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
//Mobile流量
type = "m";
} else if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
//wifi
type = "w";
item.setWifiData(totalWifi + "");
}
标签:
原文地址:http://my.oschina.net/u/2483853/blog/517647