fix: explicitly grant URI permissions for photo/video capture intents#57
Merged
Merged
Conversation
Android 18 removes automatic URI permission grants for ACTION_IMAGE_CAPTURE (and similarly affects ACTION_VIDEO_CAPTURE) intents. The file chooser's takePictureIntent and takeVideoIntent sent no grant flags for their FileProvider output URIs. RMET-5241
RMET-5241
OS-pedrogustavobilro
approved these changes
Jul 8, 2026
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.
Description
The WebView file chooser's
takePictureIntent(ACTION_IMAGE_CAPTURE) andtakeVideoIntent(ACTION_VIDEO_CAPTURE) sent no URI grant flags at all for their FileProvider output URIs. AddedFLAG_GRANT_READ_URI_PERMISSIONandFLAG_GRANT_WRITE_URI_PERMISSIONto both. Also bumped the library version to 2.0.1.Context
Android 18 removes automatic URI permission grants for
ACTION_IMAGE_CAPTUREintents (and similarly affectsACTION_VIDEO_CAPTURE) — apps must now explicitly request read/write access, or the camera app silently fails to write the captured media back into the URI.More info: https://developer.android.com/about/versions/17/behavior-changes-all#restrict-implicit-uri-grants
RMET-5241
Type of changes
Tests
Manual: exercised the WebView file chooser's photo capture and video record flows via the
capacitor-os-inappbrowserplugin'sopenInWebView, built locally against this branch. Confirmed both work on Android 8 (this library's minSdk) and Android 17.Screenshots (if appropriate)
N/A
Checklist