Suppose application is running fine but user forcibly stopped or uninstalled it, How to detect this? Is there any way to do this? Will it be good practice to write another app that will check periodically if old app is present in the system?
Asked
Active
Viewed 2.8k times
1 Answers
24
There is no way to detect this on Android, sorry.
When a user or the system force stops your application, the entire process is simply killed. There is no callback made to inform you that this has happened.
When the user uninstalls the app, at first the process is killed, then your apk file and data directory are deleted, along with the records in Package Manager that tell other apps which intent filters you've registered for.

Raghav Sood
- 81,899
- 22
- 187
- 195
-
1but if i write another app to check if my previous app exists in a system or not then is it possible? using PackageManager to check if perticular package exists in a system – – Apr 15 '13 at 11:12
-
1@sachin.surya89 Well, yes. You could have the second app open up periodically using AlarmManager and check if your app is installed. But the user can just uninstall the second app as well, so I'm not sure how this helps you. – Raghav Sood Apr 15 '13 at 11:15
-
1can we write hidden app..? like only receiver that will start a sevice on boot which will detect if perticular app exists.. http://stackoverflow.com/questions/14204720/android-hidden-application will this help. – Apr 15 '13 at 11:30
-
1@sachin.surya89 Android 3.1 fixed that security hole, and those apps will no longer work – Raghav Sood Apr 15 '13 at 11:31
-
"...and data directory are deleted". This is not true anymore. Newer versions of Android keep the files if the app has a 'allowBackup' flag – Peter Chaula Sep 15 '19 at 12:20