Open MilesAdamson opened 1 year ago
@MilesAdamson, you're welcome to contribute to this repo. Miguel is too busy :wink:
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? Cannot select file due to Destruction of MainActivity on Galaxy Note 8.
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 https://github.com/miguelpruivo/flutter_file_picker/pull/488
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.
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 retrieveLostData
from there, and inside that widget you should know the purpose of why they picked the file and do something with it
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 https://github.com/miguelpruivo/flutter_file_picker/issues/1170 https://github.com/miguelpruivo/flutter_file_picker/issues/733
Steps to reproduce
How this is handled with ImagePicker: