Android Navigation Bar problem resolved?

I’ve made app, and the client have a software navigation keys. My menus look “bad” in his device.
I tried display.getSafeAreaInsets() but that don’t work for navigation bars.
I know the size of the bar using this code that I found in this forum:
local our_DPI = system.getInfo(“androidDisplayApproximateDpi”)
local phys_pixels_int = our_DPI * 0.3
local navbar_height_int = phys_pixels_int*display.contentHeight/display.pixelHeight

But if I use this code ALL devices will have the bottom changed. Can I detect if the navigation menu is ON or OFF? I had only to make an If statement.

Or there is a better way to do detect the bottom navigation bar and returning the height size?

Hope I’m missing something.

Answering some of your questions in no particular order…

We have limited access to the “virtual” navigation bar with the key “androidSystemUiVisibility”.

The navigation bar can be hidden using native.setProperty(), with multiple options depending on Android API level. All about that here.

I don’t see a way through the API to detect whether the navigation bar is showing or not, but there is a native.getProperty() that works similar to the native.setProperty. The documentation doesn’t say what values are returned, perhaps the output can be used to determine whether the navigation bar is showing or not.

To complicate things however, as noted in the documentation, the navigation bar can reappear using gestures by the User, and would hide again or stay there depending on Android API level.

I don’t believe there’s currently a way to get the height of the navigation bar through API.
If you would like to experiment with something simpler, I found that in my scenarios on phone and tablet the navigation bar height was ~double of the top status bar (display.topStatusBarContentHeight).

If interested in hiding the navigation bar, here’s a popular code:

if system.getInfo( "androidApiLevel" ) and system.getInfo( "androidApiLevel" ) < 19 then
    native.setProperty( "androidSystemUiVisibility", "lowProfile" )
else
    native.setProperty( "androidSystemUiVisibility", "immersiveSticky" ) 
end