设备所有者未在Android Lollipop中使用NFC

sun*_*ain 2 android nfc android-5.0-lollipop device-owner

我想在不使用NFC的情况下将我的应用设为设备所有者.在开发者博客上,提到要让设备所有者必须使用NFC,但我发现在没有NFC的情况下也可能会在本评论中提到alex_au .

我试过这个,但没有成功.有人能够做到这一点吗?

Spy*_*net 5

您可以使用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.
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请检查:dpm shell命令

注意:在使用此命令之前,请确保未配置设备.如果设置了设备并且您收到"设备已配置"之类的消息,请在从设备中删除所有帐户后尝试该命令,或在出厂时重置设备后尝试.

  • 嗨@Sunil Jain目前没有这样的方法可以让你的应用程序成为生产中的设备所有者.它仅适用于公司自有设备,IT管理员可以从新设备开始并使用设备所有者进行配置.雇主可以使用已安装的可以配置全局设备设置的设备所有者应用程序来发布这些设备.Google可能会在未来版本中提供非NFC配置机制:) (3认同)