Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In Android 10, users can enable full screen gesture mode. I want to detect whether the device in full screen gesture mode or not. I can't find anything in documentation. How to do it programmatically at run time?

Java or kotlin language answer is OK.

Any official API or workaround...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
355 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use below code to check gesture or navigation mode

    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:

  • 0 : Navigation is displaying with 3 buttons

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

  • 2 : Full screen gesture(Gesture on android Q)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...