App launch behavior makes me complicated! After my app is overwritten to be upgraded while it is running, re-launching behavior is something wrong.
Normally it displays last activity running when I click its icon to resume since it was stopped by home key. This does as I expected and all activities are called in standard launchMode.
No problem there, but here is the problem. If I run the same apk to re-install or upgrade it while it is still running then the app always launches with the activity A that has android.intent.category.LAUNCHER property, does not display last activity B until I kill the app on the task manager and start it again.
I don't get this behavior, and I'm not sure the same issue will be occur when it is upgraded by play store.
The sequence to meet the situation I found is following
- install App (App should have at least 2 activities, one as a launcher, the other to move)
- launch app with app icon
- LAUNCHER activity A displays
- move to activity B
- press home key
- launch the app with app icon again
App launches with Activity B <----------------------- check point! It's fine.
press home key
- install the App again with the same version or higher
- launch app with app icon
- App launches with Activity A
- move to activity B
- press home key
- launch app with app icon
App launches with Activity A <-------------------------- check point! something wrong.
kill the app
- launch app with app icon
- App launches with Activity A
- move to activity B
- press home key
- launch app with app icon
- App launches with Activity B <-------------------------- check point! the problem has gone.
I think I got some more issues with me for this thing such as a static objects problem. so please let me know why this thing happens.
Thanks.