1

It means, how the app get the navigation bar mode in which of the following 3 modes

  • gesture navigation

  • 3-button navigation

  • 2-button navigation

Jater.Zhu
  • 23
  • 3

2 Answers2

1

You can use the below code , may not work on all android devices

public static int isEdgeToEdgeEnabled(Context context) {
        Resources resources = context.getResources();
        int resourceId = resources.getIdentifier("config_navBarInteractionMode", "integer", "android");
        if (resourceId > 0) {
            return resources.getInteger(resourceId);
        }
        return 0;
    }

The value that returned by isEdgeToEdgeEnabled function will follow below:

  • Navigation is displaying with 3 buttons

  • Navigation is displaying with 2 button(Android P navigation mode)

  • Full screen gesture(Gesture on android Q)

gtxtreme
  • 1,830
  • 1
  • 13
  • 25
  • References from answers [here](https://stackoverflow.com/questions/57624920/how-to-detect-full-screen-gesture-mode-in-mi-devices-programmatically) and [here](https://stackoverflow.com/questions/56689210/how-to-detect-full-screen-gesture-mode-in-android-10) – gtxtreme Aug 17 '21 at 08:28
0
import android.content.Context
import android.provider.Settings

enum class SystemNavigation {
    THREE_BUTTON,
    TWO_BUTTON,
    GESTURE;

    companion object {
        fun create(context: Context) = values().getOrNull(
            Settings.Secure.getInt(context.contentResolver, "navigation_mode", -1)
        )
    }
}

Usage

val systemNavigation = SystemNavigation.create(context)
Tatsuya Fujisaki
  • 1,434
  • 15
  • 18