andresmq commented on issue #561: URL: https://github.com/apache/cordova-plugin-file/issues/561#issuecomment-1716770858
> Error code 2 is a SECURITY_ERROR, which is generally related to permissions. > > This code I believe is always thrown on API 29 devices because Scoped Storage does not have Direct File Access. I believe this code is also thrown if you're attempting to write to a file that your app does not own, which is also prohibited under scoped storage rules. > > In either case, you'll need to a plugin that interfaces with android's Media Store API instead of a file-based plugin such as this one. More details on this [here](https://github.com/apache/cordova-plugin-file#androids-external-storage-quirks) along with a NPM search link for media store plugins. > > Generally speaking, if your interacting with external storage (and thus scoped storage system), migrating to a media store plugin is going to be desirable. > > Closing as fixed by #566 Thanks @breautek for your reply. There is something I don't yet understand: According to [Media store](https://developer.android.com/training/data-storage/shared/media#media_store) the **Downloaded files** collection contain the files that are stored in the _Download/_ directory and according to [Access your own media files](https://developer.android.com/training/data-storage/shared/media#storage-permission-not-always-needed) you don't need storage-related permissions to access and modify the files in that collection. Moreover, I forked the branch 7.0.0 and patched the **FileUtils** class to return false when testing if permissions are needed when accessing the _Download/_ directory and could manage to create files into that folder without any error. There is something I'm missing or the plugin should be patched to take into account the Download/ folder? Thanks in advance! -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
