Florian Meyer
1 min readAug 12, 2016

--

Hi, thanks for this post! Couldn’t find a comprehensive solution on SO. One thing though: There is no method with the signature Context. revokeUriPermission(String packageName, Uri uri, int modeFlags). The packageName parameter is only used while granting the permission.

Therefore you also don’t need the for-loop, the resolvedIntentActivities and the Intent which makes revoking Uri permissions more or less a one-liner :)

getContext().revokeUriPermission(fileUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);

--

--