简体   繁体   English

以编程方式固定 Android 屏幕没有设备所有者

[英]Android Screen Pinning Programmatically No Device Owner

I'm fairly new to Android and the changes in DeviceOwner/Screen Pinning over the last 3 versions are confusing me a bit.我对 Android 相当陌生,过去 3 个版本中 DeviceOwner/Screen Pinning 的变化让我有点困惑。

I can make an app lock as long as I set the device owner with an EMM or adb commands.只要我使用 EMM 或 adb 命令设置设备所有者,我就可以锁定应用程序。

It looks like you used to be able to start screen pinning (not Kiosk or Single App Mode - just regular screen pinning) programmatically with setLockTaskEnabled() without being Device Owner.看起来您曾经能够使用setLockTaskEnabled()以编程方式启动屏幕固定(不是 Kiosk 或单应用模式 - 只是常规屏幕固定),而无需成为设备所有者。 But I can't find documentation on that anywhere.但是我在任何地方都找不到关于它的文档。 All the documentation seems to point to ONLY locking the screen programmatically if you are under one of the 2 (3 if rooted) Device Owner methods.如果您使用 2 种(如果 root 则为 3 种)设备所有者方法之一,所有文档似乎都指向仅以编程方式锁定屏幕。

Can anyone tell me if it's possible to start screen pinning programmatically and how?谁能告诉我是否可以以编程方式开始屏幕固定以及如何开始? Or point me in the right direction?或者指出我正确的方向?

Thanks谢谢

Ugh.啊。

I just had to read one more API doc:我只需要再读一篇 API 文档:

You can still call startLockTask() (note different than the one I was trying to call).您仍然可以调用startLockTask() (注意与我试图调用的不同)。

https://developer.android.com/about/versions/android-5.0.html#ScreenPinning https://developer.android.com/about/versions/android-5.0.html#ScreenPinning

Not sure that the documentation is as clear as it could be with all this - or the naming conventions but there we are.不确定文档是否与所有这些内容一样清晰 - 或命名约定,但我们已经完成了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM