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 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.
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:
*
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.
Protect installing/uninstalling apps by password makes Android more secure from malware/viruses. Your Android become as secure as iPhone.
How it works:
Automatic apps installing is prompted to user. You can search the app name. If not secure, Block it.
Root access is prompted to user. Too many ads is an indicator that access is dangerous.
You could do this by:
ACTION_PACKAGE_REMOVED
ACTION_PACKAGE_REMOVED
It is possible. you can do it with DeviceAdminReceiver
api. (i don't no how)