Skip to content

Commit 360a73c

Browse files
authored
Docs: Expanded the docs on the limitations of external filesystems for android (#593)
1 parent faba1bf commit 360a73c

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ Each URL is in the form _file:///path/to/spot/_, and can be converted to a
9595
in here. (_iOS_, _Android_, _BlackBerry 10_, _OSX_, _windows_)
9696

9797
* `cordova.file.externalApplicationStorageDirectory` - Application space on
98-
external storage. (_Android_)
98+
external storage. (_Android_). See [Quirks](#androids-external-storage-quirks).
9999

100100
* `cordova.file.externalDataDirectory` - Where to put app-specific data files on
101-
external storage. (_Android_)
101+
external storage. (_Android_). See [Quirks](#androids-external-storage-quirks).
102102

103103
* `cordova.file.externalCacheDirectory` - Application cache on external storage.
104-
(_Android_)
104+
(_Android_). See [Quirks](#androids-external-storage-quirks).
105105

106-
* `cordova.file.externalRootDirectory` - External storage (SD card) root. (_Android_, _BlackBerry 10_)
106+
* `cordova.file.externalRootDirectory` - External storage (SD card) root. (_Android_, _BlackBerry 10_). See [Quirks](#androids-external-storage-quirks).
107107

108108
* `cordova.file.tempDirectory` - Temp directory that the OS can clear at will. Do not
109109
rely on the OS to clear this directory; your app should always remove files as
@@ -178,6 +178,26 @@ the `cordova.file.*` properties map to physical paths on a real device.
178178
**Note**: If external storage can't be mounted, the `cordova.file.external*`
179179
properties are `null`.
180180

181+
#### Android's External Storage Quirks
182+
183+
With the introduction of [Scoped Storage](https://source.android.com/docs/core/storage/scoped) access to External Storage is unreliable or limited via File APIs.
184+
Scoped Storage was introduced in API 29. While existing apps may have the ability to opt out, this option is not available for new apps. On Android API 30 and later, Scoped Storage is fully enforced.
185+
186+
Additionally, Direct File Access **is not** supported on API 29. This means this plugin **cannot** access external storage mediums on API 29 devices.
187+
188+
API 30 introduced [FUSE](https://source.android.com/docs/core/storage/scoped) which allowed limited access to external storage using File APIs, allowing this plugin to
189+
partially work again.
190+
191+
Limited access includes but isn't limited to:
192+
- Read only access with appropriate `READ_EXTERNAL` or [READ_MEDIA_*](https://developer.android.com/training/data-storage/shared/media#access-other-apps-files) permissions.
193+
- Read only access is limited to media files, but not documents.
194+
- Writes are limited to only files owned by your app. Modifying files owned by a third-party app (including an image file created via the camera plugin for example) is not possible via the File API.
195+
- Not all paths in external storage is writable.
196+
197+
These limitations only applies to external filesystems (e.g. `cordova.file.external*` paths). Internal filesystems such as `cordova.file.dataDirectory` path are not imposed by these limitations.
198+
199+
If interfacing with the external file system is a requirement for your application, consider using a [MediaStore](https://www.npmjs.com/search?q=ecosystem%3Acordova%20storage%20access%20framework) plugin instead.
200+
181201
### OS X File System Layout
182202

183203
| Device Path | `cordova.file.*` | `iosExtraFileSystems` | r/w? | OS clears | private |

0 commit comments

Comments
 (0)