I am trying to make an application device-admin, for that I'm following Developing a Device Administration Application
And when I try to run below command
./adb shell dpm set-device-owner com.example.app/.receiver.AdminReceiver
it gives SecurityException
java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_DEVICE_ADMINS.
at android.os.Parcel.readException(Parcel.java:1683)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setActiveAdmin(IDevicePolicyManager.java:4278)
at com.android.commands.dpm.Dpm.runSetDeviceOwner(Dpm.java:145)
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:343)
Can anybody please help to get out of this problem, I have removed all the accounts from mobile. I'm using redmi note 4 mobile
Having active accounts would result in different error, so it's not the case.
Please try to type in full path to receiver's package, eg com.example.app/com.example.app.receiver.AdminReceiver
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.