Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: remove WRITE_EXTERNAL_STORAGE permission from plugin.xml #556

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -269,6 +269,17 @@ Marshmallow requires the apps to ask for permissions when reading/writing to ext
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
permission to write to `cordova.file.externalApplicationStorageDirectory`.

### SDK Target less than 29

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.
> 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.
If you need to add this permission, please add the following to your `config.xml`.
```xml
<config-file target="AndroidManifest.xml" parent="/*" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
</config-file>
```

## iOS Quirks

- `cordova.file.applicationStorageDirectory` is read-only; attempting to store
3 changes: 0 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -132,9 +132,6 @@ to config.xml in order for the application to find previously stored files.
</feature>
<allow-navigation href="cdvfile:*" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</config-file>

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