1

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).

Rougher
  • 774
  • 4
  • 16
  • 43

1 Answers1

0

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

greywolf82
  • 21,003
  • 18
  • 47
  • 99
  • I search for a way to do it without a factory reset. For example, here: https://stackoverflow.com/questions/21183328/how-to-make-my-app-a-device-owner in accepted answer is written: "Also notice that this tool is working only if no account is set for the user (make sure no account is set in Settings > Accounts) before its use." – Rougher Oct 22 '19 at 03:36
  • in my experience it only works sometimes, with factory reset works always. – greywolf82 Oct 22 '19 at 04:56