How to Utilize System API for Full-Screen Display: Difference between revisions

From wizarPOS
(Created page with "For hiding the status bar and navigation bar, the system provides the following API. Please notice that after calling that API, the status bar or navigation bar will hide or...")
 
(No difference)

Revision as of 10:45, 15 March 2020

For hiding the status bar and navigation bar, the system provides the following API.

Please notice that after calling that API, the status bar or navigation bar will hide or show not only in your app, but also in all the system.

Permission

 android.permission.CLOUDPOS_HIDE_STATUS_BAR

The app declares the permission in the manifest.

API Overview

HideBars for hiding or showing the status/navigation bar

void hideBars(int state)

set status bar and navigation bar state

Parameters
state int: 1 : hide status bar, 2 : hide navigation bar, 3: hide both, 0: show both.

The follows are some snippet code:

//hideBars:
Object service = getSystemService("statusbar");
Class statusBarManager = Class.forName("android.app.StatusBarManager");
Method method = statusBarManager.getMethod("hideBars", int.class);
method.invoke(service, 3);


GetBarsVisibility

int getBarsVisibility();

get state of status bar and navigation bar.

Returns
int The result , 1 : hide status bar, 2 : hide navigation bar, 3: hide both, 0: show both.

The follows are some snippet code:

//getBarsVisibility:
Object service = getSystemService("statusbar");
Class statusBarManager = Class.forName("android.app.StatusBarManager");
Method method = statusBarManager.getMethod("getBarsVisibility");
Object object = expand.invoke(service);