tags:

views:

674

answers:

4

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
arams
IN MENU->Setting->Applications->Manage Applications->We can get what are the applications installed...Can we hide a applications name in that list.
arams
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
@arams: Why would you want to have a user install an application and then hide it from the list of installed applications?
Steg
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
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
+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
A: 

is there any software through it you can detect which software installed on your PC you want to protect it against uninstall with password..