Home Features Docs Blog Support GitHub

Hide Home Indicator (LibGDX)


(Tien Do Nam) #1

Hello guys,

I am building a game in LibGDX and want to hide the home indicator in iPhone X. After my research I found out that I have to overwrite “prefersHomeIndicatorAutoHidden”.
However I don’t know where to overwrite it in my LibGDX game.

Thanks
Tien

public class IOSMoeLauncher extends IOSApplication.Delegate implements LanguageInterface, OSVersionInterface {

    protected IOSMoeLauncher(Pointer peer) {
        super(peer);
    }

    @Override
    protected IOSApplication createApplication() {
        IOSApplicationConfiguration config = new IOSApplicationConfiguration();
        config.useAccelerometer = false;
        return new IOSApplication(new MainKlasse(this), config);
    }

    public static void main(String[] argv) {
        UIKit.UIApplicationMain(0, null, null, IOSMoeLauncher.class.getName());

    }

    @Override
    public String getLanguageCode() {
        NSLocale nsLocale = NSLocale.autoupdatingCurrentLocale();
        return nsLocale.objectForKey(Foundation.NSLocaleLanguageCode()).toString();
    }

    @Override
    public String getOSVersion() {
        NSOperatingSystemVersion version = NSProcessInfo.processInfo().operatingSystemVersion();
        long major = version.majorVersion();
        long minor = version.minorVersion();
        long patch = version.patchVersion();
        return major+"."+minor+"."+patch;
    }
}

(Roman Schauenberg) #2

Hello Tien

Did you found a solution for this problem?


(Tien Do Nam) #3

I could overwrite it after my commit (https://github.com/libgdx/libgdx/commit/cb016aa68c12fc1658abc35a4e01d412eda1a70a) which is included in LibGDX 1.9.9

You shouldn’t need to do anything but in case you want to configure it:

@Override
protected IOSApplication createApplication() {
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    config.hideHomeIndicator = true; // true is default
    [...]
}

The home indicator is hiding now but it will show up again when I touch the display…


(Roman Schauenberg) #4

Hello Tienisto

Thank you for your answer. It helps me very much!