要求输入密码以禁用安卓设备管理员[英] Require Pass-code to Disable Android Device Administrator

本文是小编为大家收集整理的关于要求输入密码以禁用安卓设备管理员的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在考虑一个安全应用程序,它将具有设备管理员权限.我想看看是否有可能在用户尝试将应用程序取消选中应用程序时作为管理员处于设置 - > Security-> Device Administrators下的管理员.这将添加一个路障,以便不容易允许用户卸载应用程序,因为它们首先需要从应用程序中删除管理权限(他们需要使用密码验证),然后他们可以卸载.这个想法是为了父母在孩子的手机上安装安全应用程序,而不是让孩子轻松卸载.没有root访问权限就可以这样做的东西?

推荐答案

在ondisableRequested()方法中启动Pass-Code活动(DeviceAdminreceiver的覆盖方法)

在Android 2.3中 只要取消激活按钮,您的活动将打开.

来自Android 4.x 单击"已停用"按钮时,活动在大约5-10秒后打开. 因此,您可以将设备从ondisabled()方法锁定,而是ondisabledicquested().

本文地址:https://www.itbaoku.cn/post/102316.html

问题描述

I was thinking of a security app which will have device administrator privileges. I wanted to see if it was possible to require a pass-code when the user tries to uncheck the app as an administrator under Settings->Security->Device Administrators. This would add a roadblock to not easily allow the user to uninstall the app as they would first need to remove the admin privileges from the app (for which they would need to authenticate with a password) and then they could uninstall. The idea is for parents to install a security app on their kids' phones and not have the kids uninstall it easily. Would something like this be possible without root access?

推荐答案

Start the pass-code activity in onDisableRequested() method (an override method of DeviceAdminReceiver)

In Android 2.3 As soon as deactivate button is clicked your activity will open.

From Android 4.x The activity opens after around 5-10 secs when deactivate button is clicked. So you can lock the device from onDisabled() method instead onDisableRequested().