I was wondering what are the usual practices or patterns in the modern world of Android development regarding the management of Back Stack, in particular, handling cases when the application is killed or crashes, and the system tries to recreate its actions, because the task created by the application still exists .
Here's a vid showing the behavior described above in the sample application: https://www.dropbox.com/s/pkm88dvdpzsw9lm/IMG_2334-480.mov?dl=0
And here the source code is basically just a simple application created using the Android Studio wizard: ssh: // git @ github.com: lukaszs-appdate / crashingtask.git
Say the application shows login activity at the beginning. Then, when the user registers with him, he downloads data from the server and allows the user to work with the data, start other actions, manage the state of the application, etc. An important assumption is that when a user, for example, switches to another application and returns to our application, they see the last action and do not return to the login. Therefore, I do not think that the combination of flags from the document https://developer.android.com/guide/components/activities/tasks-and-back-stack.html would be enough to solve the problem.
And the problem is that when: a) the application crashes and restarts; b) the application is moved to the background using the task switch button in Android, and then manually destroyed in Android Studio and returned using the task icon, then Android is trying to recreate the actions from the task. I want it to just start the application from scratch in case of these events and show the login screen.
The only solution I see is some kind of ugly parent class for all actions except the login, where we will check if any pseudo-session-variable is set, and if not, suppose the application was restarted and replaced a whole stack of tasks with login activity or make some chains of calls to final () or other smelly materials like this.
? Android , , ?
- , - , , . .