Code example for NetworkInfo

Methods: getExtraInfo, getType

0
		NetworkInfo info = connManager.getActiveNetworkInfo();
 
		if (info == null)
			return connType;
 
		if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
			connType = info.getExtraInfo().toLowerCase();
		} else if (info.getType() == ConnectivityManager.TYPE_WIFI) {
			connType = "wifi";
		} else { 
			connType = "";
		} 
 
		return connType;
	} 
 
	/** 
	 * 检查是否处于联网状态 
	 * @param ctx 
	 * @return 
	 */