the problem: my app on Xiaomi redmi note 9c fails to resume in the correct activity, when I put my app in the background and then try to resume it from the resent list or the launcher icon, the splash screen appears, and then the current activity but with not correctly initialize data (because the activity needs data from another activity that now not in memory)
in the android log, I can see that the app stops logging after it goes to the background
workaround: I created a foreground notification that seems to force the app to stay in memory with no splash screen and the last activity has now correct data
How can I fix that? I can't fix it how can I detect if my app is not in memory and restart it in the main activity instead of current?
notes: all battery settings optimizations are disabled
similar thread 1, similar thread 2, similar thread 3
miui 12.0.10
` buildFeatures { viewBinding true }
compileSdkVersion 31
buildToolsVersion '31.0.0'`