Search code examples
androidandroid-4.0-ice-cream-sandwichandroid-wifi

Access WiFi settings programmatically in Android 4.0.3


I know the method how we access WiFi settings, it is achieved through code below -

context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));

However, when I used it in android 4.0.3, it lead me to 'wireless configuration settings' page where I couldn't find 'turn on/off Wifi button'. As it is outside that wireless configuration page.

How I could achieve it? I am testing on Samsung Galaxy S2.


Solution

  • How about this?

    context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));