How to detect full screen gesture mode in android 10
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)
According to docs, there is a hasInsets()
method that returns true
if the WindowInsets
has any nonzero insets.
https://developer.android.com/reference/android/view/WindowInsets#hasInsets()
We can use it this way
view.rootWindowInsets.hasInsets()
Hope this helps!