Android - HIDE NAVIGATION BAR

Hi all.
I have developed OSCRemote for Android 7 (API 24) with JUCE and I want to hide navigation bar but don’t know how to do it. I don’t have a MainActivity file in my project where I could put this code:

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);

Maybe there is some way to implement my solution? Thanks in advance for your help.

JUCE is creating a main activity already. If you wanted a permanent solution (something at start-up and remains that way for your app, as opposed to dynamically hiding this during runtime), I recommend using the styles.xml approach. (Check out the Android Styles and Themes page for details.)

You would create this file under a very specific set of folders: res/values/styles.xml.

In that file, you would then set its data to:

<?xml version="1.0" encoding="utf-8" ?>

<resources>
    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>

        <!-- Note that this might not be necessary... I suggest testing without this. -->
        <item name="windowNoTitle">true</item>
    </style>
</resources>

Then, in the Projucer set the theme and assets up accordingly (unfortunately I can’t help with Cmake/JUCE):
image

image

I did as you suggested, but the styles file is not visible. Maybe you need to specify it in the AndroidManifest?

Did you add the file (and its parent folders) into your Projucer/cmake project and re-save?

Yes.
Ctrl+P

Hello.
Today I had a little time to study this topic.
I tweaked the styles a bit. It turned out like this:

<?xml version="1.0" encoding="utf-8" ?>

<resources>
    <style name="AppTheme.NoActionBar" parent="@style/AppTheme.NoActionBar">
        <item name="android:windowActionBar">false</item>

        <!-- Note that this might not be necessary... I suggest testing without this. -->
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

As a result, this file itself registered in the manifest. Unfortunately, the ActionBar is still not removed.
Can anyone suggest what other options there might be?

It looks like I made a mistake when copying and trimming out the fat. Here’s what we use for our app, in full:

<?xml version="1.0" encoding="utf-8" ?>

<resources>
    <style name="ActivityTheme" parent="android:style/Theme.NoTitleBar">
        <item name="android:background">#000000</item>         <!-- This line is changing the actionbar colour. -->
        <item name="android:windowBackground">#000000</item>
        <item name="android:colorBackground">#000000</item>

        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:windowFullscreen">false</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowTranslucentStatus">false</item>
        <item name="android:windowTranslucentNavigation">false</item>

        <!-- For details: https://developer.android.com/guide/topics/display-cutout -->
        <!-- For context: https://forum.juce.com/t/screen-position-problem-on-landscape-orientation-with-speaker-cutout/42282/8 -->
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    </style>
</resources>

Hello jrlanglois.
Everything is just like that. I tried everything, but the ActionBar is not removed. Apparently this is due to my old device, which is API 24. Everything works since API 30. But thanks for the help. This is my first Android app. I got a good lesson.
I tried to paste this code:

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);

to JuceApp.java, but the getWindow() symbol is not found. Might need to redefine Java libraries to include. But so far I don’t understand how to do it.