Code example for NetworkInfo

Methods: getExtraInfogetStateisConnected

0
 
		ConnectivityManager conManager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo info = conManager.getActiveNetworkInfo();
 
		if (info != null && info.isConnected()) {
			if (info.getState() == NetworkInfo.State.CONNECTED) {
				String currentAPN = info.getExtraInfo();
				if (currentAPN == null || "".equals(currentAPN)) {
					return false; 
				} else if (currentAPN.contains("wap")) {
					return true; 
				} 
 
			} 
		} 
		return false; 
	} 
 
	// �ж�һ���ַ�������һ���ַ����г��ֵĴ���