Skip to content

fix: explicitly grant read URI permission for camera capture intents#17

Merged
alexgerardojacinto merged 3 commits into
mainfrom
fix/RMET-5241-implicit-uri-grants
Jul 8, 2026
Merged

fix: explicitly grant read URI permission for camera capture intents#17
alexgerardojacinto merged 3 commits into
mainfrom
fix/RMET-5241-implicit-uri-grants

Conversation

@alexgerardojacinto

@alexgerardojacinto alexgerardojacinto commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

openDeviceCamera and createCameraIntent launch ACTION_IMAGE_CAPTURE with a FileProvider content:// URI in EXTRA_OUTPUT, but only granted write permission on it (FLAG_GRANT_WRITE_URI_PERMISSION). Added the missing FLAG_GRANT_READ_URI_PERMISSION alongside it. Also bumped the library version to 1.0.2.

Context

Android 18 removes automatic URI permission grants for ACTION_IMAGE_CAPTURE intents — apps must now explicitly request both read and write access, or the camera app silently fails to write the captured photo 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

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Tests

Manual: exercised Camera.takePhoto() (which delegates to IONCAMRMediaHelper) via the capacitor-camera plugin's example app, built locally against this branch. Confirmed photo capture works on Android 7 (API 25) and Android 17.

Screenshots (if appropriate)

N/A

Checklist

  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

Android 18 removes automatic URI permission grants for ACTION_IMAGE_CAPTURE
intents. openDeviceCamera and createCameraIntent already granted write
permission for the FileProvider output URI but not read, which the camera
app also needs.

RMET-5241

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested here, looks good, no longer get warning related to implicit intents in logcat with any of the camera methods. Approved!

Leaving a comment which is unrelated to your PR, but if you'd like to fix it here, I think it's fair to do.

Also: While testing I found an unrelated minor issue that I think we can merge and release together with this one: #18 if you'd like to do a quick 👀

Comment thread src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRMediaHelper.kt Outdated
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
@alexgerardojacinto alexgerardojacinto merged commit c47dcd9 into main Jul 8, 2026
1 check passed
@alexgerardojacinto alexgerardojacinto deleted the fix/RMET-5241-implicit-uri-grants branch July 8, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants