If you also add it as ClipData
, the permission grant will work successfully:
yourIntent.clipData = ClipData.newUri(context.contentResolver, fileName, contentUri)
The culprit is that Intent.FLAG_GRANT_READ_URI_PERMISSION
will work only for Intent.data
and Intent.clipData
, and not for extras, unless the uri permission grant has been given explicitly (inconvenient), or has been given by also adding a ClipData
.