There are known bugs - http://code.google.com/p/android/issues/detail?id=2373 and http://code.google.com/p/android/issues/detail?id=5277 that are exactly my case (tested both on 2.0.1 and 2.1).
The heart of the problem is instead of keeping my current Activities stack the OS creates new Activities on top of my old Task.
Need to note I don't use any specific flags/properties for starting my Activities or describing them in AndroidManifest.xml. Just plain defaults. I have SplashActivity and MainActivity. When after the app has just been run on OTA upgrade I go Home and click the app icon I see the SplashActivity starting again while I'd expect just returning to the alreay present MainActivity. So it results in 2 instances of MainActivity being put one over another. When I close MainActivity, then I see the underlying left from the initial task. Having 2 instances is bad for me, because the app was designed assuming there's only one instance of MainActivity (MainActivity starts a Service that makes a lot of http actions, etc).
The issue happens for me in 2 cases:
- when Eclipse starts the app on emulator
- during OTA upgrade (probably a clean/first install is also the case, but not tested)
Well, I don't care about the Eclipse case, but I do care about the OTA upgrades, because customers will be confused and will complain.
Can't believe Google still ignores the issue (it was created 1 year ago). Can anybody suggest any workaround for this issue?
As of now the only idea is to set android:launchMode="singleTask"
for MainActivity in AndroidManifest.xml. Not sure if this is a safe workaround and will not it result in some new issue, because the app should have worked as expected using defaults.