Add Expo Camera (Android)
CameraX-backed camera with permission handling.
Install
bashnpm exec --no -- expo install expo-camera
Permissions in app.json
json{ "expo": { "plugins": [ ["expo-camera", { "cameraPermission": "Allow $(PRODUCT_NAME) to access your camera." }] ] } }
Request runtime permission
tsximport { CameraView, useCameraPermissions } from 'expo-camera'; const [permission, requestPermission] = useCameraPermissions(); if (!permission) return null; if (!permission.granted) return <Button title="Grant" onPress={requestPermission} />; <CameraView style={{ flex: 1 }} facing="back" />
QR / barcode scanning
tsx<CameraView barcodeScannerSettings={{ barcodeTypes: ['qr', 'ean13'] }} onBarcodeScanned={({ data }) => console.log(data)} />
Photo capture
tsxconst cam = useRef<CameraView>(null); const photo = await cam.current?.takePictureAsync({ quality: 0.8 }); // photo.uri — local file path
Video recording (Android 13+)
tsxconst video = await cam.current?.recordAsync({ maxDuration: 60 });
Android-specific gotchas
- "Camera not available" → emulator without webcam; enable webcam in AVD config
- Permission denied permanently → show settings deep link:
Linking.openSettings() - Recording requires
RECORD_AUDIOpermission too - Some manufacturers (Xiaomi, OnePlus) restrict camera even with permission — check manufacturer-specific docs
Pair with
add-expo-secure-store-keystoreif saving images encrypted- Use
expo-image-pickerfor gallery access instead of camera


