Making my app a device owner doesn't work

拜拜、爱过 提交于 2020-01-25 06:49:09

问题


I need to update my application silently (as described here).

So I need to make my app a device owner in phone SAMSUNG S6. I use dpm command through adb shell command, so I provision my device (remove all account from Settings->Accounts), enable developer mode, enable debugging, install my app as usual (install it with Android Studio for example) and then run command:

adb shell dpm set-device-owner <PACKAGE-NAME>/.DeviceAdminComponent

But I get a next error:

java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
        at android.os.Parcel.readException(Parcel.java:1701)
        at android.os.Parcel.readException(Parcel.java:1646)
        at android.app.admin.IDevicePolicyManager$Stub$Proxy.setDeviceOwner(IDevicePolicyManager.java:6123)
        at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:148)
        at com.android.commands.dpm.Dpm.onRun(Dpm.java:96)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
        at com.android.commands.dpm.Dpm.main(Dpm.java:41)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:301)

It's a very strange. If I run this command:

adb shell dpm set-profile-owner <PACKAGE-NAME>/.DeviceAdminComponent

It works me fine.

Can somebody help me in this issue? Maybe it happens due to KNOX of SAMSUNG? (I see through Device Administrators - My Knox Policy Admin, that I can't disable).


回答1:


To set a device owner app on the phone requires a factory reset, then you can use adb command.



来源:https://stackoverflow.com/questions/58489427/making-my-app-a-device-owner-doesnt-work

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