Your app is killed for memory; what runs when the user returns?

Tests process death versus config change. Answer: no callback on kill; return runs onCreate with savedInstanceState, onStart, and onResume. ViewModels die in process death; use SavedStateHandle. Red flag: claiming onDestroy fires or ViewModels survive it.
WHAT IT TESTS: Distinguishing process death from config changes and designing state restoration. ANSWER OUTLINE: OS kills silently with no callbacks; return triggers Application.onCreate then Activity.onCreate(savedInstanceState), onStart, onResume. Config changes preserve ViewModels; process death destroys them, requiring SavedStateHandle. Store lightweight state in Bundle, heavy data in disk cache, and test with adb shell am kill. RED FLAG: Claiming onDestroy runs before kill, conflating the two scenarios, or storing large objects in Bundle.
Read the original → developer.android.com
- #android
- #activity-lifecycle
- #process-death
- #viewmodel
- #state-restoration
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.