breautek commented on issue #613: URL: https://github.com/apache/cordova-plugin-file/issues/613#issuecomment-1843596335
> Why can't be FilePlugin used as facade to media store, so any implementation of FilePlugin do not need to be rewritten. Might be possible but will be very difficult and/or error prone. Media Store interfaces exposes no file structure. It's just containers so to speak that you query against. So the concept of directories, file paths, etc doesn't really exists. So it will be hard to facade that concept using a traditional filesystem API. > I did not have enough time to look closely on SAF and Media store yet, but it seemed to me to be supposed only for media file type usage. Maybe I'm wrong. I'm pretty sure there is a misunderstanding there, but I don't interact with the external filesystem in any of my projects so I don't have first hand experience either. What I do know is filesystem access to external storage is limited to images, videos and audio files, or app's own private data (in the app's external data directory). That's why the READ_MEDIA_* permissions only includes video, audio and images, but not documents for example. If you're using the app's private data directory, like `cordova.file.externalDataDirectory`, I don't believe that restriction is imposed but I'm not 100% sure either. If you need to access other kinds of document files like zips or txt, etc, then the MediaStore API is the only path to access non-media files. Or if you're not deploying your app through app stores then the `MANAGE_EXTERNAL_STORAGE` permission may be a solution in your particular case. You should be able to use to `config-file` to add the permission declaration. The `MANAGE_EXTERNAL_STORAGE` permission I believe is not requestable (e.g. you can't prompt for the permission), the user must go into the app settings and enable your app to have broad filesystem access, which is UI only shown for apps that has `MANAGE_EXTERNAL_STORAGE` declared in the manifest. An example is something like: ``` <config-file target="AndroidManifest.xml" parent="/*" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> </config-file> ``` It's untested but presumably if the permission is declared and user has the setting enabled in the app settings, then the filesystem APIs should just work... (I think). The plugin may need to be forked to remove READ_MEDIA/READ_EXTERNAL_* checks however. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org