如何删除Android上启用了有效设备管理员的应用?

shi*_*ami 72 android uninstall device-admin

我编写了一个启用了设备管理员(DevicePolicyManager)并安装的应用程序.但是当我想要卸载它时,它会返回失败并显示此消息

WARN/PackageManager(69):不删除包com.mypackage.test:具有活动设备管理员

如何卸载或以程序方式卸载?谢谢.

Atm*_*ram 159

转到设置 - >位置和安全 - >设备管理员,然后取消选择要卸载的管理员.

现在卸载应用程序.如果它仍然表示您需要在卸载之前停用该应用程序,则可能需要在卸载之前强制停止该应用程序.

  • 对我来说有点不同,至少在华为.您应该转到设置 - >安全 - >设备管理员,然后您应该停用您的应用程序. (2认同)
  • APK(Google Play 服务)未出现在此设备管理员列表中。 (2认同)

Ree*_*eed 32

您还可以创建一个新的DevicePolicyManager,然后从应用程序中按钮的onClickListener使用removeAdmin(adminReceiver)

//set the onClickListener here
{
   ComponentName devAdminReceiver = new ComponentName(context, deviceAdminReceiver.class);
   DevicePolicyManager dpm = (DevicePolicyManager)context.getSystemService(Context.DEVICE_POLICY_SERVICE);
   dpm.removeActiveAdmin(devAdminReceiver);
}
Run Code Online (Sandbox Code Playgroud)

然后你可以卸载


raa*_*cer 5

三星上,转到“设置”->“锁定屏幕和安全”->“其他安全设置”->“手机管理员”并取消选择要卸载的管理员。

“安全”字样隐藏在我的显示器上,所以我应该点击“锁定屏幕”并不明显。

  • 停用选项对我来说是禁用的。接下来做什么? (4认同)