如何对低于 L 的 Android 版本使用 startLockTask() 方法

How can I use startLockTask() method for versions of Android Lower than L

我在程序中使用 startLockTask(),但发现它只能用于 Android L。但是我希望我的应用程序在低于 5 的版本中运行。

有什么方法可以获得类似的功能吗?

功能上,没有。固定屏幕的目的是防止用户离开您的应用程序。用户无法查看或点击通知,也无法使用主页按钮离开。

在视觉上,你 can set the app to full screen,, and/or hide notification bar. You can also hide the soft keys on devices that don't have hardware buttons。然而,人们总能把它带回来。

编辑:您也可以 disable the back button.