fluttercommunity / flutter_downloader

Flutter Downloader - A plugin for creating and managing download tasks.
https://pub.dev/packages/flutter_downloader
BSD 3-Clause "New" or "Revised" License
911 stars 511 forks source link

Permission Denial: writing com.android.providers.media.MediaProvider #496

Closed ajayamal closed 1 year ago

ajayamal commented 3 years ago

When i try to download an image from url i am getting this error W/System.err( 1845): java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=1845, uid=10513 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission() but i am using this plugin to download videos as well and its working fine on MP4

`

`

I tried adding these permissions it is still not working. PS(minSdkVersion: 23)

bouziane commented 3 years ago

I have same issue when i tried to read a mp3 file

java.lang.SecurityException: Permission Denial: reading vn.hunghd.flutterdownloader.DownloadedFileProvider uri content://com.sn114.flutter_downloader.provider/external_files/Download/audio-bande_annonce_en_bambara-_clv_feuilleton_radio-bm.mp3 from pid=4131, uid=10318 requires the provider be exported, or grantUriPermission()
E/DatabaseUtils(10811):     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:848)
E/DatabaseUtils(10811):     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:689)
E/DatabaseUtils(10811):     at android.content.ContentProvider$Transport.query(ContentProvider.java:244)
E/DatabaseUtils(10811):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106)
E/DatabaseUtils(10811):     at android.os.Binder.execTransactInternal(Binder.java:1157)
E/DatabaseUtils(10811):     at android.os.Binder.execTransact(Binder.java:1126)
Andreigr0 commented 1 year ago

I believe this is the solution https://github.com/fluttercommunity/flutter_downloader/issues/773#issuecomment-1347431145