Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect full screen gesture mode in android 10

Tags:

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...

like image 639
Jaya Prakash Avatar asked Jun 20 '19 15:06

Jaya Prakash


People also ask

Does Android 10 have Gesture navigation?

Beginning with Android 10 (API level 29), the Android system supports fully gesture-based navigation. There are two things that app developers should do to ensure their apps are compatible with this feature: Extend app content from edge to edge.


1 Answers

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)

like image 173
Trung Đoan Avatar answered Sep 18 '22 01:09

Trung Đoan