Code example for NetworkInfo

Methods: getState

0
		final WifiManager wm = (WifiManager) manager.getSystemService(Context.WIFI_SERVICE);
		mWifiLock = wm.createWifiLock(TAG);
 
		final NetworkInfo info = cm.getActiveNetworkInfo();
		if (info != null) {
			mIsConnected = (info.getState() == State.CONNECTED);
		} 
 
		mLockingWifi = lockingWifi;
 
		final IntentFilter filter = new IntentFilter();
		filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
		manager.registerReceiver(this, filter);
	} 
 
	/* (non-Javadoc) 
	 * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent) 
	 */ 
	@Override 
	public void onReceive(Context context, Intent intent) {
		final String action = intent.getAction();