Search code examples
androidandroid-activityandroid-9.0-pie

Android 9 back button when launching settings activity works incorrectly


In our application we have a special buttons which takes the user to network settings page. We use the following code

 Intent intent=new Intent(Settings.ACTION_WIRELESS_SETTINGS);
 startActivity(intent);

There are several issues with this implementation in Android 9.

  1. for some reason I see a back button when Network & Internet settings is launched. Pressing that back button takes user to the "Settings" page, instead of taking them back to my application. This is not desirable at all.
  2. Even worse, pressing the System back button takes user completely back to launcher, thus totally breaking the navigation back stack.

enter image description here

In Android 8 however everything works just fine, neither there is a software back button at the top, nor the system back buttons has the behavior described above.

enter image description here

What is wrong with Android 9? Is there a special activity action flags that I should put into the intent that launches the network settings?

P.S.

Both of the phones are Nokia 2.1, one with Android 8.1, one with Android 9.0.


Solution

  • The Android 9 implementation is the correct one, and that's why they changed it:

    https://developer.android.com/training/design-navigation/ancestral-temporal

    The Up button appears in the app bar and is used to navigate within an app based on the hierarchical relationships between screens.