Skip to content Skip to sidebar Skip to footer

Getting Permission Denied When Using A Uri Despite Flag_grant_read_uri_permission Being Set

I have two android apps A and B. I am passing a file from app A to app B and I am seeing that app B is getting the URI. I am setting the FLAG_GRANT_READ_URI_PERMISSION flag in ap

Solution 1:

What am I doing wrong?

You are trying to use FLAG_GRANT_READ_URI_PERMISSION for a file. That only works for content://Uri values, pointing to a stream served by a ContentProvider.

Use FileProvider to serve up your files via such a ContentProvider. This is also covered in a training guide, and here is a sample project demonstrating its use.

Post a Comment for "Getting Permission Denied When Using A Uri Despite Flag_grant_read_uri_permission Being Set"