Ionut J. Bejan
Ionut J. Bejan

Reputation: 754

Wrong stack behavior on first application run (before restart)

I am trying to understand some behavior of the android apps, now that I faced the following issue :

After device restart my app launches by default, but with one issue : If I put it in the background, and I try to resume it from HOME launcher, it restarts from splash

Weird is that this happens ONLY & ONLY after the device it was installed on, is restarted ! To break this behavior I have to kill the app and launch it again. From that point it works as expected -> If in background, using launcher icon restore the app state

Looking a bit in the logs from lifecycles of the activities in cause, I noticed that the flow is pretty much the same ! With the difference that after onResume of last active activity, the SplashScreen gets launched (this being LAUNCHER activity)

Now, I've seen that this might be already an issue reported to Google, even multiple times, but .. If I cannot fix or workaround it, I am at least trying to understand the flow of what happens on these cases.

Edit: Seems to be related to FLAG_ACTIVITY_NEW_TASK set in the Receiver, but.. then again I cannot start the app after boot is completed without this flag! Feels like a cycle I can't get out of..

Upvotes: 0

Views: 23

Answers (0)

Related Questions