Code example for TelephonyManager

Methods: getDataState

0
		boolean data_connecting = false, wifi_connecting = false;
		TelephonyManager tm = (TelephonyManager) context
				.getSystemService(Context.TELEPHONY_SERVICE);
		WifiManager wm = (WifiManager) context
				.getSystemService(Context.WIFI_SERVICE);
		int ds = tm.getDataState();
		int ws = wm.getWifiState();
		switch (ds) {
		case TelephonyManager.DATA_CONNECTED:
			data = true;
			break; 
		case TelephonyManager.DATA_CONNECTING:
			data_connecting = true;
		default: 
			data = false;
			data_connecting = false;
		} 
 
		switch (ws) {
		case WifiManager.WIFI_STATE_ENABLING:
Contextual code suggestions in your IDE  Get Codota for Java