gpt4 book ai didi

android - 在显示顶部和底部导航栏之前禁用/询问密码

转载 作者:行者123 更新时间:2023-11-29 15:36:23 27 4
gpt4 key购买 nike

在为平板电脑开发客户调查应用程序时,我意识到我必须禁止通知面板被拉出并隐藏底部导航以防万一,因为所有那些有趣的客户都试图成为聪明的***。

我正在使用非 root 设备,因此使用像 this 中的反射答案不是一个选项。

And while adding getWindow().addFlags(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY); will do the trick, it will also disable everything else.


我首先为应用程序请求全屏只是为了隐藏顶部栏,但这对底部导航栏没有任何影响。

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

因此我求助于使用 Immersive Full-Screen Mode .它确实隐藏了顶部和底部栏,但当用户向上或向下滑动时,它们会再次出现。

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}

The device runs on Android 4.4

我正在寻找一种方法来完全禁用它们或(最好的情况)在再次显示它们之前要求输入密码

最佳答案

如果我理解你的问题,你正在寻找的是单一用途设备,如果设备运行 Android 5 及更高版本,你可以使用 startLockTask() 函数实现你想要的这里https://developer.android.com/work/cosu.html#emm-solutions

The device owner must include your app’s package(s) in setLockTaskPackages Sets the packages that can enter into lock task mode Needs to be set by the EMM You can call isLockTaskPermitted to verify that your package has been whitelisted by setLockTaskPackages. Your activity calls startLockTask() Requests to lock the user into the current task Prevents launching other apps, settings, and the Home button To exit, your activity must call stopLockTask() Can only be called on an activity that’s previously called startLockTask() Should be called when the app is user-facing between onResume() and onPause()

看来您可以在低于 5 的 Android 版本上通过使用此处所述的这些操作来实现相同的事情:http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/

Overview

A Kiosk Mode is implemented by disabling various Android features that can be used to leave your app. The following features are affected:

  • The back button
  • The home button
  • The recent apps button
  • The power button
  • The volume buttons

关于android - 在显示顶部和底部导航栏之前禁用/询问密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48906108/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com