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?
Use AppLock If you want to prevent other users from uninstalling your apps, launch AppLock, go to Privacy, and under Advanced, lock the Settings app. In this manner, users will need to use the authentication method you previously set to open the Settings app.
Tap on the System Lock tab and toggle the Install/Uninstall switch to "on." Doing so will require a passcode in order for App Lock to be uninstalled.
You could do this by:
ACTION_PACKAGE_REMOVED
ACTION_PACKAGE_REMOVED
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With