android - Android Lollipop 中不使用 NFC 的设备所有者

标签 android nfc android-5.0-lollipop device-owner

我想让我的应用成为设备所有者,而不使用 NFC。在开发者博客上提到,要成为设备所有者,您必须使用 NFC,但我发现没有 NFC 也是可能的,正如 alex_au 在 this comment 中提到的那样。 .

我已经尝试过,但没有成功。有人能做到这一点吗?

最佳答案

您可以从 adb shell 使用命令行工具dpm

用法:

usage: dpm [subcommand] [options]
usage: dpm set-device-owner <COMPONENT>
usage: dpm set-profile-owner <COMPONENT> <USER_ID>

dpm set-device-owner: Sets the given component as active admin, and its package as device owner.
dpm set-profile-owner: Sets the given component as active admin and profile owner for an existing user.

欲了解更多信息,请查看:dpm shell command

注意:使用此命令之前,请确保设备未配置。如果设备已配置,并且您收到类似“设备已配置”的消息,请在从设备中删除所有帐户后尝试该命令,或者在将设备恢复出厂设置后尝试。

关于android - Android Lollipop 中不使用 NFC 的设备所有者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28112382/

相关文章:

java - 未能传递结果信息

java - Eclipse 在 Mac 上打不开

android - Android 上的 MIFARE Ultralight 仿真

android - 广播接收器可以处理 ACTION_NDEF_DISCOVERED 吗?

android - "IsoDep.get(tag)"调试时返回null

android - 我的 Android 应用程序使用哪些 NFC 标签有关系吗?

android - 拒绝重新初始化 Android Lollipop 上先前失败的类 java.lang.Class<library.package.class>

android material L 图像过渡插值器

Android - 从服务器下载图像并加载到 ImageView

android - Android平台Xamarin Editor Control中如何去除文本下划线?