Device Owner on rooted Galaxy S8

二次信任 提交于 2019-12-06 03:47:49

Thanks to Freds comment I looked into my manifest and compared it to another app I have been using and was able to get the Adb provisioning to work.

I added the following to my manifest and the error did not occur again:

<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />

<application       
   ...
   android:testOnly="false">

After this, the command

dpm set-device-owner my/app/namespace/.DeviceAdmin

executed without errrors.

To be honest I don't quite know which one of those did the trick since I cannot un-provision my device without doing a factory reset but I thought I'd share it anyway and hope it will save someone else some time.

From the examples you have tried it seems you are trying to get Device Owner privilege, and not Device Admin:

  • Device Admin (introduced in Android 2.2) gives limited management capabilities and can be granted by the user to any app that requests it,
  • Device Owner (introduced in Android 5.0) gives full management capabilities but can only be granted to one app, during device setup, so you need to factory reset the device before.

If you want to implement Device Admin, you can follow this guide.

If you want to implement Device Owner, you can either

  • use the Android Management API which is simple but you might be missing some advanced features,
  • or build your own Device Policy Controler app and setup the device using one of the available provisioning methods (QR code, NFC, Managed Google Play Accounts, etc), which is significantly more complicated but you'll have access to all DevicePolicyManager APIs.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!