Code example for WifiManager

Methods: createWifiLockgetConnectionInfoisWifiEnabled

0
		  
		 if(DEBUG) Log.d(NetworkService.TAG, String.format("netType=%d and netSubType=%d", netType, netSubType));
		 boolean useWifi = true;
		 boolean use3G = true;
		if(useWifi && (netType == ConnectivityManager.TYPE_WIFI)){
			if(this.wifiManager.isWifiEnabled()){
				this.wifiLock = this.wifiManager.createWifiLock(NetworkService.TAG);
				final WifiInfo wifiInfo = this.wifiManager.getConnectionInfo();
				if(wifiInfo != null && this.wifiLock != null){
					final DetailedState detailedState = WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState());
					if(detailedState == DetailedState.CONNECTED 
							|| detailedState == DetailedState.CONNECTING || detailedState == DetailedState.OBTAINING_IPADDR){
						this.wifiLock.acquire();
						connected = true;
					} 
				} 
			} 
			else{ 
				Toast.makeText(IMPSDev.getContext(), "WiFi not enabled", Toast.LENGTH_LONG).show();
				if(DEBUG) Log.d(NetworkService.TAG, "WiFi not enabled");
Connect your IDE to all the code out there  Get Codota for Java