How to remove an app with active device admin enab

2019-01-21 08:40发布

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.

4条回答
Lonely孤独者°
2楼-- · 2019-01-21 09:13

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

查看更多
萌系小妹纸
3楼-- · 2019-01-21 09:26

On Samsung go to "Settings" -> "Lock screen and security" -> "Other security settings" -> "Phone administrators" and deselect the admin which you want to uninstall.

The "security" word was hidden on my display, so it was not obvious that I should click on "Lock screen".

查看更多
神经病院院长
4楼-- · 2019-01-21 09:26

Enter vault password and inside vault right top corner options icon is there. Press on it. In that ->settings->vault admin rites to be unselected. Work done. U can uninstall app now.

查看更多
再贱就再见
5楼-- · 2019-01-21 09:28

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.

查看更多
登录 后发表回答