You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when an Activity is about to be destroyed it is marked as tearing down and resets app start state: https://github.com/MvvmCross/MvvmCross/blob/9.1.1/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs#L92
But it is not completely valid scenario on Android in case of low memory activity destroy or with option "Don't keep activities" in "Developer options" because user did not leave the app themself. So then when coming back to the app it gets correctly recreated with all the fragments and navigation stack restored. But then it navigates to the first VM again since app start status was reset and replaces all the already restored fragments and calls their VM initialization again.
Expected behavior
When coming back to the app that was destroyed by the system (not the user) and then got restored it doesn't navigate to the first VM again.
So checking only activity.IsFinishing is needed. Should be false.
If the user leaves the app intentionally by clicking Back system button or by swiping it away from Overview then activity.IsFinishing is true and then after coming back to the app it has to navigate to first VM (current behaviour for all scenarios).
Basically the correct way to fix the issue is to remove checking activity.IsDestroyed.
Reproduction steps
Enable "Don't keep activities" in "Developer options".
Open your MvvmCross app then leave it by clicking Home and come back to the app.
Configuration
Single activity app.
Not using MvxStartActivity since it's an incorrect way to start an app - you must navigate to the first VM that is an Activity.
I do call IMvxAppStart.StartAsync with condition IMvxAppStart.IsStarted (that is always false after restoration) from my single Activity and it navigates to the first VM that is a Fragment, not another Activity.
Version: 9.1.1
Platform:
馃摫 iOS
馃 Android
馃弫 WPF
馃寧 UWP
馃崕 MacOS
馃摵 tvOS
馃悞 Xamarin.Forms
The text was updated successfully, but these errors were encountered:
馃悰 Bug Report
Currently when an
Activity
is about to be destroyed it is marked as tearing down and resets app start state: https://github.com/MvvmCross/MvvmCross/blob/9.1.1/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs#L92But it is not completely valid scenario on Android in case of low memory activity destroy or with option "Don't keep activities" in "Developer options" because user did not leave the app themself. So then when coming back to the app it gets correctly recreated with all the fragments and navigation stack restored. But then it navigates to the first VM again since app start status was reset and replaces all the already restored fragments and calls their VM initialization again.
Expected behavior
When coming back to the app that was destroyed by the system (not the user) and then got restored it doesn't navigate to the first VM again.
So checking only
activity.IsFinishing
is needed. Should befalse
.If the user leaves the app intentionally by clicking Back system button or by swiping it away from Overview then
activity.IsFinishing
istrue
and then after coming back to the app it has to navigate to first VM (current behaviour for all scenarios).Basically the correct way to fix the issue is to remove checking
activity.IsDestroyed
.Reproduction steps
Enable "Don't keep activities" in "Developer options".
Open your MvvmCross app then leave it by clicking Home and come back to the app.
Configuration
Single activity app.
Not using
MvxStartActivity
since it's an incorrect way to start an app - you must navigate to the first VM that is anActivity
.I do call
IMvxAppStart.StartAsync
with conditionIMvxAppStart.IsStarted
(that is alwaysfalse
after restoration) from my singleActivity
and it navigates to the first VM that is aFragment
, not anotherActivity
.Version: 9.1.1
Platform:
The text was updated successfully, but these errors were encountered: