I am following this tutorial to add opencv and camera support to a new app in Android Studio in Java using Android 11 and Pixel 4 as emulator
I followed some comments and added
mOpenCvCameraView.setCameraPermissionGranted();
Now I get the error It seems that your device does not support camera(or it is locked)
I found some solutions here It seems that your device does not support camera(or it is locked) but I don't know how to implement them
I was able to do it by enabling the camera permissions manually in the emulator's phone settings for my app, however I would like it to request permissions on its own
The answer, It means that on Android 23 or above, besides the manifest, you need to request permission on runtime as well. In this case, camera access.
Where do I add this code? Is this even Java code? I am getting so many undefined errors when trying to paste it in the OnCreate
function.