Camera permissions on mobile (Android) #12732
|
Hi, I love the idea of Tauri and I decided I'd use it for my first mobile/cross-platform app. I'm using React for the UI and found I started going through |
Replies: 2 comments 4 replies
|
I think just adding this line https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/android/src/main/AndroidManifest.xml#L5 in gen/android/... should be enough. At least according to my own messages i wrote a while back 🙃 |
Fix: Camera & Microphone in Tauri v2 Android (getUserMedia / NotAllowedError / NotReadableError)If you're building a Tauri v2 app that uses
This guide documents every fix needed and explains why Android requires them. Why Android Is DifferentAndroid WebView has a two-layer permission system that doesn't exist on iOS or desktop:
Fix 1 —
|
| Error | Cause | Fix |
|---|---|---|
NotAllowedError: Permission denied |
WebView layer not bridged to OS permission | Fix 2 — MainActivity.kt |
NotReadableError: Could not start audio source |
Android audio subsystem not acquired | Fix 1 (MODIFY_AUDIO_SETTINGS) + Fix 2 (AudioManager.MODE_IN_COMMUNICATION) |
| Permission popup never appears | request.grant() called unconditionally |
Fix 2 — check OS permission before granting WebView |
| Works on iOS/desktop, broken on Android | WebView two-layer system not handled | All fixes above |
Environment
Tested with:
- Tauri
2.10.3 tauri-plugin-barcode-scanner2- Android
minSdk 24,targetSdk 36 - Kotlin JVM target
1.8
I think just adding this line https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/barcode-scanner/android/src/main/AndroidManifest.xml#L5 in gen/android/... should be enough. At least according to my own messages i wrote a while back 🙃