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
A:
That is not possible in Android without firmware modifications.
CommonsWare
2009-08-03 11:51:17
arams
2009-08-03 12:23:41
IN MENU->Setting->Applications->Manage Applications->We can get what are the applications installed...Can we hide a applications name in that list.
arams
2009-08-03 12:28:54
No. The only way to have applications that are not removable is to have them in firmware. Anything else the user is allowed to remove, period.
CommonsWare
2009-08-03 13:59:24
@arams: Why would you want to have a user install an application and then hide it from the list of installed applications?
Steg
2009-08-04 08:39:12
Even if your app was included in the firmware, a user with a rooted phone would be able to remove it.Conversely, if you have a rooted phone you could install it to the place where firmware apps are stored, although it might mess with the next firmware update.
Jarett
2010-07-02 15:08:57
A:
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.
jamesh
2009-08-03 20:38:36
+2
A:
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.
Isaac Waller
2009-08-05 04:11:26