In my application I need to detect when the user ends the app. When I do a reload from Android Studio what I see is that the app does not go through onDestroy.
I presume this is because the studio uses instant run? It's not an issue as long as it is limited to the dev environment.
But what happens when the user updates the app from the store? Am I sure that the app goes to onDestroy before being re-opened?
I'm not sure how exactly to test it so I thought I could ask the question from the forum.
Create an APK using your declared targets like
debug
orrelease
. Install the APK in your device. Now launch your application. While application was being in the foreground. Install APK again using the following command.This similar to app upgrade from Play Store. Just make sure both APK have same signing certificate and an increased
versionCode
.Upadte Answer: If You want to notify user when App gets killed Please try following:
In the AndroidManifest
Now start this service from start of your applicatoin.
Let me know if it works in case of upgrade.