Code example for ConnectivityManager

Methods: getNetworkInfo

0
			} 
		} else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
			ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
					Context.CONNECTIVITY_SERVICE);
			 
			NetworkInfo netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
			 
			if (netInfo.getState() == NetworkInfo.State.CONNECTED) {
				if (!mMobileConnected) {
					mMobileConnected = true;
					changed = true;
				} 
			} else if (netInfo.getState() == NetworkInfo.State.DISCONNECTING
					|| netInfo.getState() == NetworkInfo.State.DISCONNECTED) {
				if (mMobileConnected) {
					mMobileConnected = false;
					changed = true;
				} 
			} 
			 
			netInfo = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
			 
			if (netInfo.getState() == NetworkInfo.State.CONNECTED) {
				if (!mWifiConnected) {
					mWifiConnected = true;
					changed = true;
Connect your IDE to all the code out there  Get Codota for Java