-
Notifications
You must be signed in to change notification settings - Fork 720
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
Handle MainActivity destruction on Android (like retrieveLostData of ImagePicker) #1258
Comments
@MilesAdamson, you're welcome to contribute to this repo. Miguel is too busy 😉 |
This issue is stale because it has been open for 14 days with no activity. |
Sorry I don't think I can add this feature for you |
Any workaround? |
Not that I know of. Users are not able to pick files on certain tablets in my app either |
someone already try to add that feature, but no response anymore |
Are there any updates on this topic? Why did the author just close this 488 ? |
Sorry — I've been a bit away from the project so I'm trying to catch'all the missing stuff. Is this an issue as of today? Would #488 fix it? |
This is still in the same state as when I created the issue. From what I can tell that PR would solve it yes but I didn't test out his branch |
Handling main activity destruction is hard when the app has more than two functions that call to pick an image. I can not know the retrieveLostData from what function. I have to remove getLostData() from my app. |
I solved that issue in my app by using restoration scope, so the user is brought back to where they were. Then in the init state of where they were, calling |
Issue
When an Android device is low on memory, or for whatever reason the OS chooses, the MainActivity can be destroyed when the file picker is opened. When the user returns to the app, the file they selected is lost. This is more likely to happen on weaker devices, and with phones that very aggressively kill activities to save battery (Samsung).
It is possible to restore the user to the screen they last were in with flutter's built in RestorationScope, but it's not possible to grab the file they picked. This can put users in a loop where they then try again to pick the same file, MainActivity is killed, the resume where they were without the file picked, and so on. Making it impossible to pick the file.
Related, but they all get automatically closed
#1170
#733
Steps to reproduce
How this is handled with ImagePicker:
The text was updated successfully, but these errors were encountered: