One strategy would be to define an interface encapsulating what “app state” means for you and persisting an instance of it into Storage
whenever it is modified. Then, on app startup, you can read it back from storage and restore it to whatever provider holds it during normal operation. Something I consider a major benefit of this approach is that it works regardless of whether the app was GCd by the OS (which is probably what you’re encountering as “sometimes closes”) or if the user explicitly quits the app.
↧
How to keep app open in background
↧