6

i create an app and install it on phone. now i want to add a feature that my app should not uninstall from the phone. so i think if one of the following issues could be solved

  1. is there anyway to stop the user from uninstall the app?
  2. is it possible , if user try to uninstall the app we get a message?
  3. is it possible , if user try to uninstall the app it should prompt for a password ?
  4. any other way to know that app got uninstalled?

Please guide me in this regard thanks in advance

nimi
  • 586
  • 1
  • 10
  • 20

3 Answers3

8

Yes, this can be done.

Create a new firmware image for a phone, include your app in the /system/app directory and, since this directory is read-only during runtime, the app cannot be uninstalled. i.e. it is pre-installed.

Otherwise no, this cannot be done. However, with a non-system app, the system does notify other applications after your app has been uninstalled via a PACKAGE_REMOVED broadcast.

So it's possible to determine that your app was uninstalled, but — without flashing the whole phone with a new firmware — there is no way to prevent your application from being uninstalled. Which is a good thing.

Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
  • no did'nt mean it. actually both of your and were about to same so i excepted both ans. – nimi Dec 20 '10 at 12:35
  • how can we use this package remove broadcast. because if i add this with my app it is of no use. so how can we manage this. – nimi Dec 20 '10 at 12:38
  • You can only accept one answer (the one with the green checkmark). Anyway, there's nothing you can do with the `PACKAGE_REMOVED` broadcast to prevent an app from being installed -- it just answers point 4 of your question. – Christopher Orr Dec 20 '10 at 20:50
  • @ChristopherOrr can you show me a sample or Learning for create a new firmware and include app in /system/app ? i need it ! thanks – محمد Jan 26 '15 at 04:46
3

is there any way to stop the user from uninstall the app?

I hope there isn't.

Try to make an application that users will not want to uninstall anyway :)

cherouvim
  • 31,725
  • 15
  • 104
  • 153
1

is it possible , if user try to uninstall the app we get a message?

As Christopher said above, you can be notified when the user has removed your application.

PACKAGE_REMOVED broadcast is sent to notify that a package is removed. You can use it to get notified.

But I don't find it right to "prevent" user from removing your application. As a matter of UX, its their phone, and they've got full rights to add/remove whatever they want.

It is the same with PCs too!

Aman Alam
  • 11,231
  • 7
  • 46
  • 81
  • 2
    Not sure why a less accurate answer than mine has been accepted ;) But you can't directly use the PACKAGE_REMOVED broadcast, as the app being uninstalled doesn't receive it. Also, that it's not "right" to prevent users from removing apps is moot, as it's not possible for regular apps on Android. – Christopher Orr Dec 20 '10 at 10:42
  • The credit goes to you brother!! :-) I even voted your answer up! :-) – Aman Alam Dec 20 '10 at 11:24
  • 1
    Indeed, one will have to have another app monitoring uninstallation of the intended one! :-P – Aman Alam Dec 20 '10 at 11:25