Code example for WifiManager

Methods: createWifiLockisWifiEnabledsetWifiEnabled

0
           case INIT_WIFI: 
   			if (wm != null) 
			{ 
				// create wifi lock if not sleeping enabled 
   				if (sleepWIFI == false) 
   					wifi_lock = wm.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, "NORSWifiLock"); 
				  
				// is Wifi switched off and shall we switch it on? 
				if (wm.isWifiEnabled() == false && enableWIFI == true) 
				{ 
					try 
					{ 
						wm.setWifiEnabled(true); 
					} 
					catch(Exception e) 
					{ 
					} 
				} 
				// Register Broadcast Receivers 
				nors.registerReceiver(WifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); 
				nors.registerReceiver(WifiReceiver, new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION));