How to Call Wi-Fi Settings Screen from My Application Using Android

Android Things How to call WiFi settings from app

The default WiFi settings activity has been removed in recent previews. You can use the network manager APIs to programmatically connect to networks or use the default launcher which has a WiFi settings section.

Specify an activity back from native WiFi settings screen

Try to call Wi-Fi setting from your app using this code:

startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)
.putExtra("extra_prefs_show_button_bar", true)
.putExtra("extra_prefs_set_back_text", "Back to the app!")
.putExtra("extra_prefs_set_next_text", ""));

Call wireless settings screen with back button

    Intent intent = new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK);       
intent.putExtra("only_access_points", true);
intent.putExtra("extra_prefs_show_button_bar", true);
intent.putExtra("wifi_enable_next_on_connect", true);
startActivityForResult(intent, 1);

This should do it. Reverse engineered from google code.

Copied from How can I overlay a 'back' and 'next' button on a " pick wifi network " window?.

Set or View Advanced Wi-fi Settings programatically

There are two more settings that might work for you:

From the API documentation:

  • Settings.ACTION_WIRELESS_SETTINGS

    startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
  • Settings.ACTION_WIFI_IP_SETTINGS

    startActivity(new Intent(android.provider.Settings.ACTION_WIFI_IP_SETTINGS));

Try those two and see if they open what you're after.



Related Topics



Leave a reply



Submit