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

From wizarPOS
Line 6: Line 6:


== API Overview ==
== API Overview ==
=== <big>HideBars for hiding or showing the status/navigation bar</big> ===
=== <big>Hide or show status/navigation bar using HideBars</big> ===
   <syntaxhighlight lang="java">void hideBars(int state)</syntaxhighlight >  
   <syntaxhighlight lang="java">void hideBars(int state)</syntaxhighlight >  
set status bar and navigation bar state
set status bar and navigation bar state
Line 26: Line 26:


</syntaxhighlight >
</syntaxhighlight >


=== <big>GetBarsVisibility</big> ===
=== <big>GetBarsVisibility</big> ===

Revision as of 10:50, 15 March 2020

To hide the status bar and navigation bar, the following APIs are provided. Note that after calling the API, the status bar or navigation bar is hidden or displayed not only in your application, but also throughout the system.

Permission

 android.permission.CLOUDPOS_HIDE_STATUS_BAR

The application declares permissions in the manifest.

API Overview

Hide or show status/navigation bar using HideBars

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);