Code example for NetworkInfo.State

Methods: equals

0
		if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
 
			final NetworkInfo networkInfo = intent
					.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
 
			if (networkInfo.getState().equals(State.CONNECTED)) {
				enableSync(); 
			} else if (networkInfo.getState().equals(State.DISCONNECTED)) {
				disableSync(); 
			} 
 
		} else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
 
			final int wifiState = intent.getIntExtra(
					WifiManager.EXTRA_WIFI_STATE,
					WifiManager.WIFI_STATE_ENABLED);
 
			if (wifiState == WifiManager.WIFI_STATE_DISABLED) {
				disableSync(); 
			} else if (wifiState == WifiManager.WIFI_STATE_ENABLED) {
				enableSync();