Skip to content

Commit 4cd85f3

Browse files
authored
Merge pull request #556 from knight9999/(android)dev_remove_WRITE_EXTERNAL_STORAGE
feat: remove WRITE_EXTERNAL_STORAGE permission from plugin.xml
2 parents b32be30 + 2eb7dc5 commit 4cd85f3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,20 @@ Marshmallow requires the apps to ask for permissions when reading/writing to ext
269269
for these two directories unless external storage is not mounted. However due to a limitation, when external storage is not mounted, it would ask for
270270
permission to write to `cordova.file.externalApplicationStorageDirectory`.
271271

272+
### SDK Target Less Than 29
273+
274+
From the official [Storage updates in Android 11](https://developer.android.com/about/versions/11/privacy/storage) documentation, the [`WRITE_EXTERNAL_STORAGE`](https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE) permission is no longer operational and does not provide access.
275+
276+
> If this permission is not allowlisted for an app that targets an API level before [`Build.VERSION_CODES.Q`](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q) (SDK 29) this permission cannot be granted to apps.
277+
278+
If you need to add this permission, please add the following to your `config.xml`.
279+
280+
```xml
281+
<config-file target="AndroidManifest.xml" parent="/*" xmlns:android="http://schemas.android.com/apk/res/android">
282+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
283+
</config-file>
284+
```
285+
272286
## iOS Quirks
273287

274288
- `cordova.file.applicationStorageDirectory` is read-only; attempting to store

plugin.xml

-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ to config.xml in order for the application to find previously stored files.
132132
</feature>
133133
<allow-navigation href="cdvfile:*" />
134134
</config-file>
135-
<config-file target="AndroidManifest.xml" parent="/*">
136-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
137-
</config-file>
138135

139136
<source-file src="src/android/EncodingException.java" target-dir="src/org/apache/cordova/file" />
140137
<source-file src="src/android/FileExistsException.java" target-dir="src/org/apache/cordova/file" />

0 commit comments

Comments
 (0)