Tag Archives: WifiManager

How will you programatically enable or disable WIFI in android?

By | September 30, 2011

Hello all.. This is a simple code snippet to enable WI-FI in android programatically in android. [java] public boolean enableWIFI() { WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE); if(wifiManager.isWifiEnabled()){ if(wifiManager.setWifiEnabled(false)) return true; }else{ if(wifiManager.setWifiEnabled(true)) return true; } return false; } [/java] Note : Make sure to add the permissions in the manifest file. These are the permissions. [xml] <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"… Read More »