How can I open settings programmatically?
You can open with
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
You can return by pressing back button on device.
This did it for me
Intent callGPSSettingIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(callGPSSettingIntent);
When they press back it goes back to my app.
You can try to call:
startActivityForResult(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS));
for other screen in setting screen, you can go to
https://developer.android.com/reference/android/provider/Settings.html
Hope help you in this case.
Check out the Programmatically Displaying the Settings Page
startActivity(context, new Intent(Settings.ACTION_SETTINGS), /*options:*/ null);
In general, you use the predefined constant Settings.ACTION__SETTINGS
. The full list can be found here
To achieve this just use an Intent using the constant ACTION_SETTINGS, specifically defined to show the System Settings:
startActivity(new Intent(Settings.ACTION_SETTINGS));
startActivityForResult() is optional, only if you want to return some data when the settings activity is closed.
startActivityForResult(new Intent(Settings.ACTION_SETTINGS), 0);
here you can find a list of contants to show specific settings or details of an aplication.
You can make another class for doing this kind of activities.
public class Go {
public void Setting(Context context)
{
Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
Use this intent to open security and location screen in settings app of android device
startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
来源:https://stackoverflow.com/questions/19517417/opening-android-settings-programmatically