Kitesurfer Kitesurfer - 7 months ago 38
Android Question

Is Camera the Front or Back Facing

when i open the Camera like this:

Camera cam =;


Camera cam =;

How can i get information that this is the Front or Back Camera ? Some Devices may have both, some just one.

I need that Information when writing some logic of my code, also for logging.



First of all you may want to look at the reference of Camera class.

Methods getNumberOfCameras (does this device have only one camera or both?) and getCameraInfo ( will provide you with the exact information that you need.

There is an example of using both these methods:

private int findFrontFacingCamera() {
    int cameraId = -1;
    // Search for the front facing camera
    int numberOfCameras = Camera.getNumberOfCameras();
    for (int i = 0; i < numberOfCameras; i++) {
      CameraInfo info = new CameraInfo();
      Camera.getCameraInfo(i, info);
      if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
        Log.d(DEBUG_TAG, "Camera found");
        cameraId = i;
    return cameraId;