Hide navigation bar?
Asked Answered
H

3

5

I am on android 6. Looking for solutiong where I can hide and disable nav bar with soft keys(home, back, recent). On a google page (COSU IMPLEMENTATION) there is a picture comparing pinning and lock task modes, and on the right side we can see options looks like "Home and Recent buttons are hidden", prior to pin mode. But I didnt find any method to do it. I already locked an activity, but still can call nav bar with swipe up. Maybe someone here knows it.

Higgledypiggledy answered 28/10, 2017 at 18:29 Comment(3)
Thanks for your attention. As fas as I posted before: I am using COSU. It means app is only for commerrial use with android device with only one this app I`m developing. Sorry, had to write it before.Higgledypiggledy
There is no reverse engineering here @BernoulliGate he is asking basically how can one use the Locked Task mode for his app.Review
Sounds like we should remove it, since this isn't about reverse engineering.Review
H
7

Ok. For everybody who faces. Its impossible to hide navigation bar at all. On a google web page we can see only "HOME AND RECENT BUTTONS ARE HIDDEN", but not the BACK button. So for now with startLockTask() method we can hide everything BUT BACK button. Also disabling status bar it wont be invisible. You can still call it with swipe but there are nothing on it.

Higgledypiggledy answered 7/11, 2017 at 9:30 Comment(0)
A
1

You no longer need to implement a Device Policy Controller to manage Android devices, Google has recently released the Android Management API which allows you to set up a COSU device with just a few Cloud API calls.

To lock the device on one app, or on multiple app, you define a kiosk policy like below, it will disable the navigation buttons (sample copied from Create a policy). And in addition you can set statusBarDisabled to disable the status bar and other overlays that could allow to escape your app.

"applications": [
 {
   "packageName": "com.example.app",
   "installType": "FORCE_INSTALLED",
   "lockTaskAllowed": true,
   "defaultPermissionPolicy": "GRANT",
 },
"persistentPreferredActivities": [
  {
    "receiverActivity": "com.example.app/.com.example.app.MainActivity",
    "actions": [
      "android.intent.action.MAIN"
    ],
    "categories": [
      "android.intent.category.HOME",
      "android.intent.category.DEFAULT"
    ]
  }
],
"statusBarDisabled": true
Asher answered 29/10, 2017 at 11:12 Comment(5)
Is it free? Still trying to understand what is it exactly.Higgledypiggledy
It is a free API offered by Google to make device management easier on Android, you just need a Cloud project. If you plan to deploy your solution at scale you should also join the Google EMM community, to get active support and to lift the default quota of 10 devices (the API stays free even after lifting the quota).Asher
Trying to create policy. Already did it. Am I right: when new device will finish setup wizard I will have to enter " afw#setup" then enter code received in enrollmentTokens.create and device will be now in touch with Google Cloud? What about app? How it will receive and install package I typed in the previos step (policy create)?Higgledypiggledy
Correct, and you can also update the policy after setting up the device. The apps in applications need to be uploaded in Google Play in order to be installed automatically, and if you don't want you app to be publicly visible in Play you can upload it as private. Hope that helps.Asher
This is an usable "solution" from Google in corporation environments. A COSU solution is much better, even if the bars appear if you swipe.Adalie
M
-2

You can see the official documentation, that show you how you can hide navigation bar: Official Android documentation

Metalloid answered 7/11, 2017 at 17:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.