I am looking to the setup device owner from custom setup wizard app programmatically Currently, I am testing with google sample testDpc app.
I am able to ask for provisioning mode by using the calling ACTION_GET_PROVISIONING_MODE intent, but I don't know what to do after receiving there result
Process proc = Runtime.getRuntime().exec("dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver");
If I try to run the above command then I am getting the below error
Exception occurred while executing 'set-device-owner':
java.lang.SecurityException: Calling identity is not authorized
I want to setup device as orgnization owned work profile from setup wizard (COPE profile)
Use DevicePolicyManager's hide method: setActiveAdmin and setDeviceOwner
SetDeviceOwnerPolicyTask.run is an example.