|
|
Line 1: |
Line 1: |
| == Overview ==
| | {{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/other-development/display-full-screen-api}} |
| This guide explains how to use specific system APIs to hide the status bar and navigation bar, enabling a full-screen display on Android devices.
| |
| == Important Considerations ==
| |
| Be aware that using these APIs affects the entire system, not just your application. When you hide the status bar or navigation bar, it remains hidden across all system interfaces and applications.
| |
| == Permission ==
| |
| android.permission.CLOUDPOS_HIDE_STATUS_BAR
| |
| The application declares permissions in the manifest.
| |
| | |
| == API Overview ==
| |
| === <big>Hide or show status/navigation bar using HideBars</big> ===
| |
| <syntaxhighlight lang="java">void hideBars(int state)</syntaxhighlight >
| |
| Set status bar and navigation bar state.
| |
| {|class="wizarpostable" | |
| |-
| |
| ! scope="row" colspan="2" | Parameters
| |
| |-
| |
| | state || '''int:''' 1 : hide status bar, 2 : hide navigation bar, 3: hide both, 0: show both. ''<big>In device without navigation bar, set 2 and 3 will throw IllegalArgumentException.</big>''
| |
| |}
| |
| Here are some code snippets:
| |
| <syntaxhighlight lang="java">
| |
| //hideBars: | |
| Object service = getSystemService("statusbar");
| |
| Class statusBarManager = Class.forName("android.app.StatusBarManager");
| |
| Method method = statusBarManager.getMethod("hideBars", int.class);
| |
| method.invoke(service, 3);
| |
| | |
| </syntaxhighlight >
| |
| | |
| === <big>GetBarsVisibility</big> ===
| |
| <syntaxhighlight lang="java">int getBarsVisibility();</syntaxhighlight >
| |
| Get the state of the status bar and navigation bar.
| |
| {|
| |
| |-
| |
| |
| |
| |}
| |
| {|class="wizarpostable"
| |
| |-
| |
| ! scope="row" colspan="2" | Returns
| |
| |-
| |
| | int || The result , 1 : hide status bar, 2 : hide navigation bar, 3: hide both, 0: show both. In device without navigation bar, set 2 and 3 will throw IllegalArgumentException.
| |
| |}
| |
| Here are some code snippets:
| |
| <syntaxhighlight lang="java">
| |
| //getBarsVisibility:
| |
| Object service = getSystemService("statusbar");
| |
| Class statusBarManager = Class.forName("android.app.StatusBarManager");
| |
| Method method = statusBarManager.getMethod("getBarsVisibility");
| |
| Object object = expand.invoke(service);
| |
| </syntaxhighlight >
| |
| == Download ==
| |
| Please download and run [http://ftp.wizarpos.com/advanceSDK/HideStatusBarTest-signed-20180323.apk HideStatusBar Test APK]
| |