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