Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State not reloaded #260

Closed
mikepschneider opened this issue May 24, 2017 · 2 comments
Closed

State not reloaded #260

mikepschneider opened this issue May 24, 2017 · 2 comments

Comments

@mikepschneider
Copy link

I've configured Flow in my single-activity app according to the documentation. The backstack works correctly and I can see via the debugger that the stack is saved out when the app is closed.

However, when I reopen the app the InternalLifecycleIntegration.load() function is never called.

In my Activity I can see that the normal onCreate, onStart, onResume lifecycle is followed.

Why would the app not reload the saved state?

@mikepschneider
Copy link
Author

mikepschneider commented May 24, 2017

With further digging it seems that InternalLifecycleIntegration.onActivityCreated() is always called with a null bundle, thus it is unable to load. However I clearly see that a reasonable bundle (with the right screen objects) is being created in InternalLifecycleIntegration.onSaveInstanceState() and added to the outState bundle. But it seems like the OS just doesn't resupply the saved bundle in onActivityCreated.

Any idea why this would happen? FYI I am using a Pixel emulator with API 25. Also tried a Motorola Nexus 6 (not emulator) with API 24 and same results.

Is the idea of Flow that it only saves/restores the state during the onStop/onStart events, and not the onDestroy/onCreate events? I do see the state being restored in onStop/onStart, however the implication I had by reading the docs is that it would be persisted across the FULL lifecycle (ie create/destroy). Is that a false reading of the docs?

@Zhuinden
Copy link

Bundle will be non-null if you put the application in background with HOME, click the "terminate application" button in Android Studio, then relaunch the app from launcher. This is how you can simulate low memory condition behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants