Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

android - Stop uninstallation of application

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...