How can an Android application know it has been automatically updated without restarting the device?

279 Views Asked by At

I have an application that is running 24/7 on a dedicated Android device. The app is configured in Google Play to update automatically. The app downloads and installs without any issues.

The part I am trying to figure out is: the app needs to recognize there has been an update downloaded and installed by Google Play and subsequently should stop, and restart itself.

Possible?

1

There are 1 best solutions below

0
On

Quite pointless, as your installed (old) application is replaced by updated one, which also means old one is being killed first, then overwritten. If you need to know you are "new" one, make each app i.e. store its versionCode. On launch check stored versionCode against package versionCode and act accordingly