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.
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.
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
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 You can see the official documentation, that show you how you can hide navigation bar: Official Android documentation
© 2022 - 2024 — McMap. All rights reserved.