Menu

White bar appears after using hideSystemBar() to remove navigation bar

Environment 

  • Knox SDK
  • Android 9
  • Kiosk Mode

Overview

After using the Knox SDK API KioskMode.hideSystemBar() in Android 9, the navigation bar is hidden and replaced by a white bar. Below is some sample code demonstrating the API usage:
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(this);
KioskMode km = edm.getKioskMode();
km.hideSystemBar(true);
When the above is invoked, the status bar and the navigation bar are hidden.

Cause

By API design, the top status bar and navigation buttons are hidden with the white space appearing in its place. 

Resolution

This is expected Knox API behaviour, as the purpose of the API is only to hide the status bar and navigation buttons from view.

Workaround

To ensure the white bar is removed while still hiding the navigation buttons, invoke SystemManager.setStatusBarMode() instead. The following is an example of how to do this: 
CustomDeviceManager cdm = CustomDeviceManager.getInstance();
SystemManager sm = cdm.getSystemManager();
sm.setStatusBarMode(CustomDeviceManager.HIDE);
NOTE — You must have a KPE Premium license to use the CustomDeviceManager object.

Additional information

Use either KioskMode.hideSystemBar(boolean) or SystemManager.setStatusBarMode(int), but not both.
  1. If KioskMode.hideSystemBar(true) is called and then SystemManager.setStatusBarMode(CustomDeviceManager.HIDE) is called, SystemManager.setStatusBarMode(CustomDeviceManager.HIDE) will not work.
  2. If SystemManager.setStatusBarMode(CustomDeviceManager.HIDE) is called and then KioskMode.hideSystemBar(true) is called, then SystemManager.setStatusBarMode(CustomDeviceManager.SHOW) will fail.
Share it: