Android - launch basic settings. Activity does not always work.

FLAG_ACTIVITY_NO_HISTORY does not work to trigger Android settings activity (android.provider.Settings.ACTION_SETTINGS)

I have an activity with which I launch the Android settings window (android.provider.Settings.ACTION_SETTINGS). I do it like this:

Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); activityContext.startActivity(intent); 

This usually works. However, when I do the following:

1) run the settings from my activity 2) go further (i.e. wireless networks and networks), 3) click home, etc. 3) start your activity again 4) launch settings from my activity 5), then instead of the basic settings for Android settings, the “Wireless Networks” screen will appear.

I also tried:

 Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityContext.startActivity(intent); 

But it doesn’t work either. Do you know what could be the problem? I wanted to add that the FLAG_ACTIVITY_NO_HISTORY flag works for my internal actions.

+4
source share
1 answer

Try adding the Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag to the intent.

+5
source

All Articles