We are happy to announce that we have just released an update for cordova-plugin-file
!
To upgrade:
cordova plugin remove cordova-plugin-file cordova plugin add cordova-plugin-file@8.0.0
Removed WRITE_EXTERNAL_STORAGE
permission
According to the official documentation on Storage updates in Android 11, the WRITE_EXTERNAL_STORAGE
permission is no longer operational and does not grant access to write to external storage.
If this permission is not allowlisted for an app that targets an API level before
Build.VERSION_CODES.Q
(SDK 29) this permission cannot be granted to apps.
Although Cordova has removed this permission from the plugin by default, you can still add it back if needed by using the config-file
tag in your project's config.xml
file.
Example:
<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="32" /> </config-file>
It's important to note that other plugins used in your Cordova project may still include the WRITE_EXTERNAL_STORAGE
permission. To verify whether the permission is added by other plugins, you can check the merged AndroidManifest.xml
file.
The merged AndroidManifest.xml
file can be found at the following location:
platforms/android/app/build/intermediates/merged_manifest/debug/AndroidManifest.xml
Please keep in mind that the example file path provided above is specific to debug builds. For release builds or different build variants, the file path may vary slightly.
Android 13+ Support
Beginning from Android 13 (SDK 33), the READ_EXTERNAL_STORAGE
permission no longer has any effect. Instead, this permission has been replaced with more granular permissions: READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
, and READ_MEDIA_AUDIO
.
To adapt to this change, we have introduced these three new permissions. This ensures that the existing functionality and behavior related to reading various media file are maintained for Android 13 and higher versions.
Furthermore, to support the new granular permissions and Android 13 (SDK 33), we have raised the minimum requirement for cordova-android
to version 12.0.0
. This version of Cordova-Android specifically includes the necessary updates to handle Android 13 and compile your project with the new permissions successfully.
Please report any issues you find by following the this How to File a Bug guide!
FileError
on a content resolveLocalFileSystemURL
READ_MEDIA_*
permissions for Android 13+cordova-android@12
requirement@cordova/eslint-config@5.0.0
w/ fixesWRITE_EXTERNAL_STORAGE
permission from plugin.xml
FileWriter.write
to support ArrayBuffer
datacordova-android@11