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

Add Android Native filechooser and external SD card path to StoragePath #491

Merged
merged 5 commits into from
Dec 26, 2018

Conversation

KeyWeeUsr
Copy link
Contributor

Adds external (micro) SD card path detection because otherwise the filechooser would return wrong path e.g.:

/storage/emulated/0/file.txt
/storage/extSdCard/file.txt

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 a system 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.

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

Successfully merging this pull request may close these issues.

2 participants