-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛[android] Camera.requestCameraPermission() does not resolve after giving camera permissions. #1423
Comments
i am using this its working fine const requestCameraPermission = async () => { |
I managed to get it working too by using |
I was able to get it to work by doing the following: Android Manifest: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera.any" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
Methods: async function checkPermissions() {
let cameraPermission: CameraPermissionStatus = 'not-determined';
let microphonePermission: CameraPermissionStatus = 'not-determined';
try {
cameraPermission = await RNCamera.getCameraPermissionStatus();
microphonePermission = await RNCamera.getMicrophonePermissionStatus();
} catch (e) {
console.log(e, 'checkPermissions');
}
return {
camera: cameraPermission,
microphone: microphonePermission,
};
}
async function requestPermissions() {
let cameraPermission: CameraPermissionStatus = 'denied';
let microphonePermission: CameraPermissionStatus = 'denied';
try {
cameraPermission = await RNCamera.requestCameraPermission();
microphonePermission = await RNCamera.requestMicrophonePermission();
} catch (e) {
console.log(e, 'requestPermissions');
}
return {
camera: cameraPermission,
microphone: microphonePermission,
};
} |
Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3. I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here? Here's an instruction on how you can test that: #1674 (comment) If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Thank you! |
What were you trying to do?
The following are my reproduction steps for Android (phone and emulator).
await Camera.requestCameraPermission();
.Reproduceable Code
What happened instead?
It seems the call
await Camera.requestCameraPermission()
does not resolve when it requests for camera permissions. It hangs and the camera never appears.I would expect the call to resolve so that I can use the camera.
Relevant log output
No response
Device
Android v11 (Realme 6 Pro)
VisionCamera Version
2.15.2
Additional information
The text was updated successfully, but these errors were encountered: