Device Owner without using NFC in Android Lollipop

喜你入骨 提交于 2019-12-08 02:56:20

问题


I want to make my app as Device Owner without using NFC. On developer blog it's mentioned that to make device owner you must use NFC but I found it is also possible without NFC as mentioned by alex_au in this comment.

I have tried this but haven't been successful. Has anybody been able to accomplish this?


回答1:


You can use command line tool dpm from adb shell.

Usage:

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.

For more information check: dpm shell command

Note: Before using this command make sure that device is not provisioned. If device is provisioned and you get message like "Device is already provisioned" try the command after removing all the accounts from device or try after factory resetting the device.



来源:https://stackoverflow.com/questions/28112382/device-owner-without-using-nfc-in-android-lollipop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!