Thursday 8 November 2012

turn on or off the wifi connection in android Programatically

Hello Android Guys,

This is a simple tutorial which covers following parts:
     1. Programatically  turn on or turn off the wifi connection without going to setting option
         in android. For this you have to do two things

     A. Passing Permission inside your AndroidManifest.xml file:
   <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

     B. Inside your Activity
              I. For turning off the wifi

       WifiManager wifiManager = (WifiManager)context.getSystemService

             II. For turning on the wifi   

        WifiManager wifiManager = (WifiManager)context.getSystemService

Hope , this will Help some one.
Cheers :)
Happy Coding :)

Mukesh Kumar

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....


Post a Comment


Copyright @ 2013 Android Developers Blog.