fix(android): explicitly grant URI permissions for image capture intent#8526
Open
alexgerardojacinto wants to merge 1 commit into
Open
fix(android): explicitly grant URI permissions for image capture intent#8526alexgerardojacinto wants to merge 1 commit into
alexgerardojacinto wants to merge 1 commit into
Conversation
Android 18 removes automatic URI permission grants for ACTION_IMAGE_CAPTURE intents. Explicitly add FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION so the camera app can access the FileProvider output URI. RMET-5241
OS-pedrogustavobilro
approved these changes
Jul 8, 2026
OS-pedrogustavobilro
left a comment
Contributor
There was a problem hiding this comment.
LGTM; Tested in https://github.com/OS-pedrogustavobilro/capacitor-framework-implicit-uri-grants, working well!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Android 18 removes automatic URI permission grants for
ACTION_SEND,ACTION_SEND_MULTIPLE, andACTION_IMAGE_CAPTUREintents (apps must now explicitly request them).BridgeWebChromeClient.showImageCapturePicker()launches the camera with a FileProvidercontent://URI inEXTRA_OUTPUTbut never explicitly granted read/write access to it, so on Android 18+ the camera app would silently fail to write the captured photo back into that URI.FLAG_GRANT_WRITE_URI_PERMISSIONandFLAG_GRANT_READ_URI_PERMISSIONto theACTION_IMAGE_CAPTUREintent.Part of RMET-5241.
Test plan
<input type="file" accept="image/*" capture>photo capture flow via a minimal Capacitor test app and confirmed the captured photo loads back into the WebView.