我想让我的应用成为设备所有者,而不使用 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/