breautek commented on issue #442:
URL: https://github.com/apache/cordova/issues/442#issuecomment-1773743992

   Access to `externalRootDirectory` is limited under Android's scoped storage 
rules, though I think `resolveLocalFileSystemURL` should still "work", but what 
you do on it might be limited. I don't believe you can create new directories 
in the root external directory anymore. You don't tell us what the `n` error 
function is actually attached to, or what the actual error is.
   
   If you're trying to resolve to the Documents directory, that directory is a 
standard directory on android, therefore it should be safe to do something like 
   
   ```
   const documentsDir = cordova.file.externalRootDirectory + "Documents";
   window.resolveLocalFileSystemURL(documentsDir, function (dirEntry) {
   
   }
   ```
   
   > What permission should I add to be able to write a .CSV file in the 
"Documents" folder ?
   
   Now this largely depends on whether your app "owns" the csv file. The short 
answer is, no permission is needed, or there is no permission available and 
what you're attempting to do is now impossible with the filesystem.
   
   Under scoped storage rules, no permissions are needed to read/write to files 
that your files owns/created.
   
   If the file is owned by another application, then you **cannot** write to 
that file using filesystem. Android literally does not support overwriting 
other apps files directly through the filesystem. Additionally for third-party 
files, Android only supports reading Images, Videos, and Audio files, but not 
"Document" files like a CSV file, with the appropriate permissions 
(`READ_EXTERNAL STORAGE` for API 32 and earlier, or `READ_MEDIA_IMAGE`, 
`READ_MEDIA_VIDEO`, `READ_MEDIA_AUDIO` for API 33 and later).
   
   If you wish to write a third-party file, a media store plugin that 
interfaces with the native `MediaStore` API must be used, which unlike the 
filesystem api that this plugin implements, has support to get temporary 
permission to read/write to a third-party file.
   
   Also note that specifically on API 29 (Android 10) Android does not support 
the external filesystem at all via filesystem APIs. See [more 
details](https://github.com/apache/cordova-plugin-file#androids-external-storage-quirks).


-- 
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

Reply via email to