How to call Wi-Fi settings screen from my application using Android
Solution 1:
Look at android.provider.Settings
for a series of Intent
actions you can use to launch various settings screens (e.g., ACTION_WIFI_SETTINGS
).
EDIT: Add the coding line.
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
Solution 2:
example
ConnectivityManager manager = (ConnectivityManager)
getSystemService(MainActivity.CONNECTIVITY_SERVICE);
/*
* 3G confirm
*/
Boolean is3g = manager.getNetworkInfo(
ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
/*
* wifi confirm
*/
Boolean isWifi = manager.getNetworkInfo(
ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
if (is3g) {
textView.setText("3G");
} else if (isWifi) {
textView.setText("wifi");
} else {
textView.setText("nothing");
// Activity transfer to wifi settings
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
}
Solution 3:
Just have to call an intent with a context, try this:
startActivity(new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK));