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.

4

3 回答 3

6

好的。对于所有面对的人。根本不可能隐藏导航栏。在谷歌网页上,我们只能看到“主页和最近的按钮被隐藏”,但看不到返回按钮。所以现在使用 startLockTask() 方法,我们可以隐藏所有 BUT BACK 按钮。还禁用状态栏它不会是不可见的。您仍然可以通过滑动调用它,但上面没有任何内容。

于 2017-11-07T09:30:17.557 回答
1

您不再需要实施设备策略控制器来管理 Android 设备,Google 最近发布了Android 管理 API,它允许您通过几个 Cloud API 调用来设置 COSU 设备。

要将设备锁定在一个应用程序或多个应用程序上,您可以定义如下所示的信息亭策略,它将禁用导航按钮(从创建策略复制的示例)。此外,您可以设置statusBarDisabled禁用状态栏和其他可能允许您的应用程序逃逸的覆盖。

"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
于 2017-10-29T11:12:01.747 回答
-1

您可以查看官方文档,向您展示如何隐藏导航栏: Android 官方文档

于 2017-11-07T17:23:35.770 回答