Closed hrp03 closed 6 months ago
Those are read permissions and has nothing to do with write.
https://developer.android.com/reference/android/Manifest.permission#READ_MEDIA_AUDIO
https://developer.android.com/reference/android/Manifest.permission#READ_MEDIA_IMAGES
https://developer.android.com/reference/android/Manifest.permission#READ_MEDIA_VIDEO
Doc for each permission say:
Allows an application to read <...> files from external storage.
With scoped storage you don't need permissions to write to external storage, however it's forbidden to modify files that isn't owned by you. Android offers no permission to allow modifying other app's external files. (e.g. there is no WRITE_MEDIA_IMAGES
). This is documented here, in short if you want to modify another app's external file, you'll need a plugin that interfaces with the MediaStore
API.
The hasWritePermission will always return true to allow you to write to your own external files.
This change isn't in a stable release yet, but a release that contains this patch is being voted on and assuming there are no objections, we should have a release soon and it should address the concern that you're attempting to address.
Platforms affected
Android
Motivation and Context
When writing a file on Android devices where version is >= 13 getting false as permission while checking runtime write permission.
Description
On Android devices >= 13 the write permission has not been checked and it always returns as false. This is happening in FileUtils.java file in getWritePermission method.
The same issue also has been raised and it this pull request will solve that
https://github.com/apache/cordova-plugin-file/issues/610
Testing
Tested the code on real devices where android versions are 11, 12, and 13 respectively. Able to write files now.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)