I believe that this question duplicate this Auto-restart app after market update
Anytime I publish a new version of my app in the Market, if the user had enabled the "auto update" option, the app will be updated automatically.
The app contains a service that runs constantly. But when the automatic update happens, the old running app is killed, but the new one is not started. Since the update happens mostly transparently to the user, it makes sense that the app's service should be started again automatically after the update so that there is almost no interruption of the service.
It's a bit difficult to test this with a real update from the market, so I'm using the following two adb commands to simulate this update process. Install of the 1st version:
adb install oldversion.apk // (version code is 1 ) Automatic update:
adb install -r newversion.apk // (version code is 2)
In my case, I have two activities, the first is MainActivity and the secondActivity. If the user is using the secondActivity and app is updated automatically (for me, I am using adb command to install the new version), how to trigger run MainAcitivty after the app is updated a new version successfull?