I wrote an app with device admin enabled (DevicePolicyManager) and installed. But when I want to uninstall it, it returns failed with this message
WARN/PackageManager(69): Not removing package com.mypackage.test: has active device admin
How can I uninstall it, or uninstall it programmically? Thanks.
YOU CAN TRY (1ST PROCESS) "SETTINGS>APPS>(LOOK FOR AN UNIDENTIFIED APP)>UNINSTALL".
Like other MDM software, Device Administrator applications can set policies on usage of the phone. They can enforce password complexity requirements, automatically lock the device, disable installed applications, and even wipe the device, all without any confirmation or approval from the user.
Go to SETTINGS->Location and Security-> Device Administrator and deselect the admin which you want to uninstall.
Now uninstall the application. If it still says you need to deactivate the application before uninstalling, you may need to Force Stop the application before uninstalling.
You could also create a new DevicePolicyManager and then use removeAdmin(adminReceiver) from an onClickListener of a button in your app
//set the onClickListener here { ComponentName devAdminReceiver = new ComponentName(context, deviceAdminReceiver.class); DevicePolicyManager dpm = (DevicePolicyManager)context.getSystemService(Context.DEVICE_POLICY_SERVICE); dpm.removeActiveAdmin(devAdminReceiver); }
And then you can uninstall
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With