-
Notifications
You must be signed in to change notification settings - Fork 64
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
Feature Request(Android): MediaStore API #334
Comments
Why isn't it practical? Scoped storage did add some restrictions, such as making the external root directory (either sdcard or emulated) an non-writable path, but apps can still write to the predefined folders such as external Pictures, Audio, etc. You can also read files from external storage that was written by the app. Reading files written by other apps still requires the |
I created a new plugin simply because that's faster to do, https://github.com/customautosys/cordova-plugin-saf-mediastore I think we should consider making Mediastore / SAF a core part of Cordova Android. It really is the way forward for file saving on Android. |
That's not entirely accurate. Scoped Storage (And the MediaStore APIs) are for dealing with files that uses the External storage system on android. a Media Store plugin could be used in addition to the file plugin, but it definitely won't replace the file plugin, which can interact with both the internal filesystem as well as the external filesystem. Currently the file plugin handles this through the Direct File API. But I do understand the MediaStore is the recommended approach for interfacing with the external filesystem. To be clear, I'm not pushing back on the MediaStore API. I'm just asking the what it provides over the File plugin or why it's not practical. For example, how were you providing UI to the user to choose where to save a file before and why doesn't that work now? |
I was using https://github.com/ourcodeworld/cordova-ourcodeworld-filebrowser which does not display the files in the folders disallowed by scoped storage. When you navigate to such a folder then you can't go anywhere and you're stuck and have to close the picker. That's why I had to write the MediaStore / SAF plugin. File plugin also fails on a scoped storage device whenever you write to something that's not the app's own folder, whether in internal or external storage. So it ends up being pretty limited. |
To addon... Starting with API 33, |
Hi, I was using cordova-plugin-file, but now with scoped storage it is not practical if I want to allow the user to choose where they want to save the file.
The alternative is MediaStore API, however, https://github.com/Heartade/cordova-plugin-android-mediastore allows only saving a single image to the gallery and https://github.com/a-ferrari/com-thesis-cordova-plugins-pdfstore only a single PDF file.
This should be part of core functionality as many apps need to download files to a location selected by the user.
The text was updated successfully, but these errors were encountered: