需要密码才能卸载/删除应用程序 [英] Require a password to uninstall/remove application
本文介绍了需要密码才能卸载/删除应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要求才允许卸载/删除我的应用程序的用户键入密码。我怎样才能实现这个功能?
I would like to require that a user type a password before being allowed to uninstall/remove my application. How can I implement this functionality?
推荐答案
您可以通过做到这一点:
You could do this by:
- 在第一次安装在您的应用程序,安装一个单独的应用程序/包(守望者)。
- 唯一的阶级守望者中包含的一个BroadcastReceiver监听
ACTION_PACKAGE_REMOVED
- 添加一个BroadcastReceiver到您的应用程序,还监听
ACTION_PACKAGE_REMOVED
- 当一个意图被广播到你的接收机之一,检查是否仍安装其他组件。如果不是(用户只需卸载它),提示输入密码 - 如果它是错的,重新安装其他组件。如果这是正确的,卸载自己。
- The first time your app is installed, install a separate application/package ("watcher").
- The only classes "watcher" contains is a BroadcastReceiver that listens for
ACTION_PACKAGE_REMOVED
- Add a BroadcastReceiver to your application that also listens for
ACTION_PACKAGE_REMOVED
- When a intent is broadcast to one of your receivers, check if the other component is still installed. If is isn't (the user just uninstalled it), prompt for the password - if it's wrong, reinstall the other component. If it's right, uninstall yourself.
这篇关于需要密码才能卸载/删除应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文