esys-flutter-share icon indicating copy to clipboard operation
esys-flutter-share copied to clipboard

SecurityException: Permission Denial on share

Open jovanovski opened this issue 6 years ago • 11 comments

I get this when I try to share an image

E/DatabaseUtils( 9486): java.lang.SecurityException: Permission Denial: reading de.esys.esysfluttershare.EsysFlutterShareFileProvider uri content://com.gorjan.airquality.fileprovider.github.com%2Forgs%2Fesysberlin%2Fesys-flutter-share/files/aircare.png from pid=8132, uid=1000 requires the provider be exported, or grantUriPermission()
E/DatabaseUtils( 9486): 	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:729)
E/DatabaseUtils( 9486): 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:602)
E/DatabaseUtils( 9486): 	at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:593)
E/DatabaseUtils( 9486): 	at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:507)
E/DatabaseUtils( 9486): 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:307)
E/DatabaseUtils( 9486): 	at android.os.Binder.execTransactInternal(Binder.java:1021)
E/DatabaseUtils( 9486): 	at android.os.Binder.execTransact(Binder.java:994)

The sharing somehow succeeds still, but this expectation is printed in the console.

jovanovski avatar Jun 08 '19 14:06 jovanovski

Can confirm this issue

PerLycke avatar Nov 05 '19 08:11 PerLycke

same here. sharing does not work

filly82 avatar Dec 11 '19 10:12 filly82

same issue on Android 10 device, but does not occur on Android 9. Sharing does work nonetheless in both cases.

Capscreen avatar Jan 19 '20 11:01 Capscreen

I am having same problem on android 10 devices. Any solution ?

ysnklcky avatar Mar 23 '20 08:03 ysnklcky

I am having same problem. Any solution ?

souzaosmar avatar Mar 27 '20 18:03 souzaosmar

Same on Android 10.

mbabuglia avatar Apr 13 '20 16:04 mbabuglia

I have submitted a pull request . In the mean time you can use this in your pubspec.yaml

esys_flutter_share: git: url: git://github.com/jawad12345A/esys-flutter-share.git

jawad12345A avatar Apr 21 '20 12:04 jawad12345A

I've the same issue, is this fixed?

FilipeOS avatar May 27 '20 17:05 FilipeOS

I have submitted a pull request . In the mean time you can use this in your pubspec.yaml

esys_flutter_share: git: url: git://github.com/jawad12345A/esys-flutter-share.git

Use this

jawad12345A avatar May 27 '20 18:05 jawad12345A

I have submitted a pull request . In the mean time you can use this in your pubspec.yaml esys_flutter_share: git: url: git://github.com/jawad12345A/esys-flutter-share.git

Use this

To share a file in Whatsapp for example from local app folder would be like this?

_recordedFile = File("$local/Sound-{$timerName}.wav");

var bytes = await _recordedFile.readAsBytes();
    try {
      await Share.file('File title', 'myfile.wav', bytes, 'audio/wav');
    } catch (e) {
      print('error: $e');
    }

FilipeOS avatar May 27 '20 18:05 FilipeOS

I think this is the solution https://github.com/MertcanDinler/Flutter-Advanced-Share/issues/2#issuecomment-445327215 especially this line registrar.context().grantUriPermission(packageName, fileHelper.getUri(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);

Can you implement it?

adrianvintu avatar Aug 22 '20 10:08 adrianvintu