I am trying to set an app as a device owner/admin using the ADB shell command on a non-rooted Android device. The app package name is "com.cloudflare.onedotonedotonedotone."
I have used the following ADB command:
adb shell dpm set-device-owner com.cloudflare.onedotonedotonedotone/.com.cloudflare.onedotonedotonedotone.MainActivity
However, I am encountering the following exception:
java.lang.SecurityException: Calling identity is not authorized
...
I do not want to root the device, and I understand the security implications. Are there any specific permissions or steps I am missing to set an app as a device owner/admin without rooting?
Any guidance or suggestions would be greatly appreciated. Thank you.
Tried this :
adb shell dpm set-device-owner com.cloudflare.onedotonedotonedotone/.com.cloudflare.onedotonedotonedotone.MainActivity
Error :
Exception occurred while executing 'set-device-owner':
java.lang.SecurityException: Calling identity is not authorized
at com.android.internal.util.Preconditions.checkCallAuthorization(Preconditions.java:247)
at com.android.server.devicepolicy.DevicePolicyManagerService.setActiveAdmin(DevicePolicyManagerService.java:3350)
at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.runSetDeviceOwner(DevicePolicyManagerServiceShellCommand.java:256)
at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.onCommand(DevicePolicyManagerServiceShellCommand.java:89)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.devicepolicy.DevicePolicyManagerService.onShellCommand(DevicePolicyManagerService.java:9913)
at android.os.Binder.shellCommand(Binder.java:1054)
at android.os.Binder.onTransact(Binder.java:882)
at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:6054)
at android.os.Binder.execTransactInternal(Binder.java:1290)
at android.os.Binder.execTransact(Binder.java:1249)