Immersive Mode

Android 4.4 (API Level 19) introduces a new SYSTEM_UI_FLAG_IMMERSIVE flag.

The following picture illustrates the different "immersive mode" states:

 

  1. Non-immersive mode—This is how the app appears before it enters an immersive mode. It is also how the app appears if you use the IMMERSIVE flag, and the user swipes to display the system bars.
  2. Reminder bubble—The system displays a reminder bubble at the first time users enter immersive mode in your app. The reminder bubble reminds users how to display the system bars.

    Note: If you want to force the reminder bubble to appear for testing purposes, you can do so by putting the app in immersive mode, turning off the screen with the power button, and then turning the screen back on again within 5 seconds.

  3. Immersive mode—This is the app in immersive mode with the system bars and other UI controls hidden.
  4. Sticky flag—This is the UI you see if you use the IMMERSIVE_STICKY flag, and the user swipes to display the system bars. Semi-transparent bars temporarily appear and then hide again. The act of swiping doesn't clear any flags, nor does it trigger your system UI visibility change listeners, because the transient appearance of the system bars isn't considered a UI visibility change.

 

To enable Immersive mode, you should call:

ImmersiveMode.Instance.EnableImmersiveMode();

 

It will use IMMERSIVE_STICKY flag. If a user has Android versision less than Android 4.4 (API Level 19), call will be ignored, so you do not have to do any additional checks. Just call in on your app start, and your game will run in immersive mode if it's possible.

 

An example of API use can be found in AnOtherFeaturesPreview.cs file.

Example Scene:

Plugins -> StansAssets -> Modules -> AndroidNative -> xExample -> Scenes -> Other -> OtherFeatures