breautek commented on issue #613: URL: https://github.com/apache/cordova-plugin-file/issues/613#issuecomment-1805827166
> You mean to use this plugin instead - https://www.npmjs.com/search?q=ecosystem%3Acordova%20storage%20access%20framework ? > > @breautek maybe you can give me example code which I can try as these plugins github pages are not very informative? I've never used any of these plugins myself in my own work so I don't have first-hand experience. Some community members was talking about this plugin over at https://github.com/apache/cordova/discussions/424 maybe it has some code snippets that you can get an idea how it works. > By the way if I will use cordova.file.externalRootDirectory I get error code 9 Under scoped storage rules creating new files in the root directory is forbidden. The android docs says to use the existing sub-directories for shared content, or your application data directory. File APIs which this plugin interfaces with are not very usable for external storage management anymore since API 29 which is when scoped storage came into effect. In fact, when scoped storage was first introduced on API 29 they completely disabled file system access across the board to the external filesystem. So this plugin will not work at all on API 29 devices. Android implemented something in API 30 they called Fuse which binds the Filesystem APIs to the scoped storage model, which allows limited access to the external storage via filesystem APIs. They primarily did this to allow NDK libraries to read media content. So effectively this file plugin is best used for internal storage use only. > Android 11 or higher supports Filesystem in Userspace (FUSE), which enables the MediaProvider module to examine file operations in user space and to gate access to files based on the policy to allow, deny, or redact access. Apps in scoped storage that use FUSE get the privacy features of scoped storage and the ability to access files using a direct file path (keeping File APIs working in apps). Unfortunately the media store API is a drastically different API and it will be quite a feat if possible to facade the media store API behind a filesystem-like API. Which is also in part the reason they implemented the Fuse system for API 30+ devices. > Android 10 enforced scoped storage rules on file accesses by MediaProvider, but not for direct file path access (for example, using File API and NDK APIs) due to the effort required in intercepting kernel calls. As a result, apps in scoped storage couldn't access files using a direct file path. This restriction impacted app developers' ability to adapt as it required substantial code changes to rewrite File API access to the MediaProvider API. References: https://source.android.com/docs/core/storage/scoped -- 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