I have an application with a lot of action. Among them is InitialActivity , which loads the main data. This is launch activity, and none of the following actions can work without downloaded data.
So, I launch the application, InitialActivity loads the data, then goes to MainActivity , and then browses through some FarAwayActivity . Then I move on to other applications (some of them are heavy) and my application gets killed in the background. I injected a log call into my Application.onCreate() and I see that it is called again when I return to my application. Therefore, I am sure that the application was killed in the background. But Android brings the most recent FarAwayActivity to the beginning, and it is immediately reset because all the downloaded data is zeros.
So the question is: how can I tell an application to start with InitialActivity when (and only when) it is killed and restored? Something like βforget my back stack,β but presumably automatically, in the manifest.
I already read and tried everything: An action tag document , but nothing matches my expectations. The closest thing is android:clearTaskOnLaunch="true" , but it clears all other actions on the stack when the application restarts from the desktop (and the application has not yet been killed, so all data is available). To be clear, I want to start with InitialActivity only after the application has actually been killed.
source share