moberwasserlechner / capacitor-filesharer

Capacitor plugin to download and share files for the Web, Android and iOS! Stop the war in Ukraine!
MIT License
82 stars 20 forks source link

Error when sharing images on Android #48

Open peacelighter opened 1 year ago

peacelighter commented 1 year ago

Hi, we would appreciate any guidance on below issue:

When trying to use the plugin to share/download images on android, we always get the below error message:

java.lang.SecurityException: Permission Denial: reading com.byteowls.capacitor.filesharer.FileSharerProvider URI content://com.xxx.app.filesharer.fileprovider/capfilesharer/share.png from pid=9439, uid=1000 requires the provider to be exported, or grantUriPermission()

We made the below attempts to fix it 1: Adjusting the configurations in manifestxml and paths, but it wasn't successful. 2: Added active permission acquisition with getContext().grantUriPermission(getContext().getPackageName(), contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); but it wasn't successful. 3: The source code uses startActivity(Intent.createChooser(sendIntent, title)). If changed to startActivity(sendIntent), the error won't occur.

peacelighter commented 1 year ago

Just realized our issue is the same mentioned on the previous thread, #46