Require Pass-code to Disable Android Device Administrator

落花浮王杯 提交于 2019-11-30 20:05:00

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/11910624/require-pass-code-to-disable-android-device-administrator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!