jitain sharma
jitain sharma

Reputation: 604

Setup Wi-Fi from an Android app

Android app which i am developing has some modes like:

Now my question is while my app is running in a Kiosk mode it will blocks all the other apps to open/make himself on the top. So user is unable to go to the settings screen.

I want a way to provide a Wi-Fi settings within my app so that user can do:

  1. Search for the Wi-Fi nearby
  2. Select and provide the password
  3. Can see which Wi-Fi node is connected

Any help will be appreciated.

Upvotes: 0

Views: 444

Answers (1)

Jed
Jed

Reputation: 8132

I know this is a bit old, but just in case it saves someone a little bit of research in the future this is a solution that I came up with for a similar use case.

Just use the activity that Android provides for managing wifi (without the user seeing the rest of the settings) by manually assembling an intent like so:

Intent intent = new Intent("com.android.net.wifi.SETUP_WIFI_NETWORK");
intent.setComponent(ComponentName.unflattenFromString("com.android.settings/com.android.settings.wifi.WifiSetupActivity"));
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);

Upvotes: 2

Related Questions