I'm working on large project, so there is some logic for saving application state, and then opening correct activity(fragment) when it comes from background. But anyway, I've found that if user navigates through my app and then minimize it - android opens it from background in different ways in following cases:
So, what is the difference between launching application from background by this two ways? I always thought, that it is the same mechanism, but, obviously, I was wrong.
Thanks for any answers
You should pay atention on the folowing docs Activity and Tasks. In short words: if user start app from recents you will receive onRestart before onStart (without onCreate it means that your app was just "suspended"). You able to save screen state using onSaveInstanceState(). But in general starting from icon and from recents - different application behaviors and you should provide proper code for this ways.
UPD
As described below root cause of unexpected behaviour was additional launch mode attribute.