Require a password to uninstall/remove application

前端 未结 5 1176
悲&欢浪女
悲&欢浪女 2020-11-27 15:41

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?

相关标签:
5条回答
  • 2020-11-27 16:12

    You can exec logcat and get the start activity intent information. You will find that before the uninstall activity is displayed, there is a text msg such as: Starting activity: Intent { act=android.intent.action.DELETE dat=package:com.comodo.pimsecure cmp=com.android.packageinstaller/.UninstallerActivity } then you can pop a activity ask for password now.

    0 讨论(0)
  • 2020-11-27 16:20

    This is a hard problem. I can think of at least one non-evil use-case for it.

    e.g. Stolen Phone Recovery app - you wish to deter ne'er-do-wells from uninstalling the app.

    In this case, I can think of two sensible assumptions which would stop me implementing what you're looking for:

    • the thief is unaware of your app, so will not try to uninstall it.
    • the thief is aware of your app, and switch it off until he can get it to an iron box* to re-install the OS.

    * For the uninitiated: an iron box will prevent the device sending or receiving electromagnetic signals.

    Of course, this answer amounts to You Ain't Going To Need It, though I suspect you have already thought this through.

    0 讨论(0)
  • 2020-11-27 16:20

    Protect installing/uninstalling apps by password makes Android more secure from malware/viruses. Your Android become as secure as iPhone.

    How it works:

    1. Automatic apps installing is prompted to user. You can search the app name. If not secure, Block it.

    2. Root access is prompted to user. Too many ads is an indicator that access is dangerous.

    0 讨论(0)
  • 2020-11-27 16:30

    You could do this by:

    • 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.
    0 讨论(0)
  • 2020-11-27 16:39

    It is possible. you can do it with DeviceAdminReceiver api. (i don't no how)

    0 讨论(0)
提交回复
热议问题