Add Android Native filechooser and external SD card path to StoragePath #491
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds external (micro) SD card path detection because otherwise the filechooser would return wrong path e.g.:
Android lacks an official API for fetching the path to the external SD card, however
/storage
folder contains both internal and external card. A user can read only those files by default. Might be an issue for rooted devices though if the folders are available for reading for root. This should not be an issue due to file ownership of asystem
user, however manufacturers can change anything.Due to the Android's internals we need to "listen" for the response from user's filechooser
Activity
. Implementation details are properly described in the platform filechooser file. The same listener approach is added even to the all remaining platforms and preferably we might even switch to that because for other platforms it's a blocking call.Switching to callbacks later would mean a user could just call a non-blocking
filechooser.open_file(on_selection=lambda path: func(path))
and the execution of the app would continue.