Detect Android Rear Camera

Is there a way to detect that an Android device has a rear camera? I’m struggling to find out how this is possible in C#

My app needs to know if there is a rear camera and act accordingly. The presence of a front camera is irrelevant but I do need to know if a rear camera is available

Thanks

Try this:

WebCamDevice[] devices = WebCamTexture.devices;
WebCamDevice rearCamera;
foreach (WebCamDevice cam in devices){
    if(!cam.isFrontFacing){
        rearCamera = cam;
        break;
    }
}
bool hasARearCamera = (rearCamera != null);

Hi, thanks for such a speedy response!

I’m a bit confused with this code as I understand it to be seeing if there is a front camera and if there is one sets a variable to access it?

Is that correct? This is not actually what I am trying to achieve.

I need to know if the device has a rear camera not the front. My app needs a rear camera to be present and cannot make use of the front camera

Thanks