How to enable Immersive Mode in Android?

Hey there, I’m looking for how to enable immersive mode in an OpenFrameworks android app.

This is a description of immersive mode:

I’m doing this inside my main.cpp:

ofAppAndroidWindow * androidWindow = new ofAppAndroidWindow();

And this isn’t setting immersive mode as I expect.
Thank you,



To enable immersive mode, call setSystemUiVisibility() and pass the SYSTEM_UI_FLAG_IMMERSIVE flag in conjunction with SYSTEM_UI_FLAG_FULLSCREEN and SYSTEM_UI_FLAG_HIDE_NAVIGATION.

but I’m not sure how or where to put this Java.

I found a solution or a workaround at least: in the file of the project in the onCreate method it works to add

                .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + View.SYSTEM_UI_FLAG_IMMERSIVE);