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.

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
LionisIAm
  • 751
  • 3
  • 17
  • 1
    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. – LionisIAm Oct 28 '17 at 18:37
  • There is no reverse engineering here @BernoulliGate he is asking basically how can one use the Locked Task mode for his app. – JoxTraex Oct 28 '17 at 23:46
  • 1
    Sounds like we should remove it, since this isn't about reverse engineering. – JoxTraex Oct 29 '17 at 07:55

3 Answers3

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.

LionisIAm
  • 751
  • 3
  • 17
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
Fred
  • 2,191
  • 1
  • 12
  • 14
  • Is it free? Still trying to understand what is it exactly. – LionisIAm Oct 29 '17 at 12:29
  • 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). – Fred Oct 29 '17 at 12:49
  • 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)? – LionisIAm Oct 29 '17 at 12:54
  • 1
    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](https://developers.google.com/android/management/apps#upload_your_own_app_to_the_google_play_store). Hope that helps. – Fred Oct 29 '17 at 13:03
  • This is an usable "solution" from Google in corporation environments. A COSU solution is much better, even if the bars appear if you swipe. – The Berga Feb 27 '20 at 16:55
-2

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

Mohamed Baddi
  • 13
  • 1
  • 5