title: android deprecated camera class
body: <p>I'm using the deprecated android camera object. I read here:
  <a href="https://source.android.com/devices/camera/versioning.html" rel="nofollow">https://source.android.com/devices/camera/versioning.html</a></p>
  
  <p>that even though the camera object is deprecated it should still work for android 5.0+ version. I ask this, because I released an app that uses the deprecated camera object and my friends downloaded the app and it crashes. They reported the errors and I see in the trace stack that the camera can't even open. This app works on my phone and my phone is version 5.0+. So maybe I'm not opening the camera correctly??? Or maybe those phones can't use the deprecated class. Here's my code for opening the camera:</p>
  
  <pre><code>@Override
  public void onResume() {
      super.onResume();
      if(!StopTouch)//ignore this condition not relevant to the problem
          StartUpCam();
  }
  
  private void StartUpCam()
  {
  
          if(faceProc==null)//ignore this as well
              faceProc = FacialProcessing.getInstance();
          camera=Camera.open(getCid()); //crashes here!!! Calls getCid() which is defined below
          camera.setPreviewCallback(this);
          initPreview(width, height);
          startPreview();
          startTimer();
  }
  
  private int getCid()
  {
      if(cameraFront &amp;&amp; findFrontFacingCamera()&gt;0)
          return findFrontFacingCamera();
      return findBackFacingCamera();
  }
  
  public static int findBackFacingCamera() {
      int cameraId = -1;
      int numberOfCameras = Camera.getNumberOfCameras();
      for (int i = 0; i &lt; numberOfCameras; i++) {
          CameraInfo info = new CameraInfo();
          Camera.getCameraInfo(i, info);
          if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
              cameraId = i;
              break;
          }
      }
      return cameraId;
  }
  
  public static int findFrontFacingCamera() {
      int cameraId = -1;
      int numberOfCameras = Camera.getNumberOfCameras();
      for (int i = 0; i &lt; numberOfCameras; i++) {
          CameraInfo info = new CameraInfo();
          Camera.getCameraInfo(i, info);
          if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
              cameraId = i;
              break;
          }
      }
      return cameraId;
  }
  </code></pre>
  
  <p>Anyone else having issues with the deprecated camera class when they release their app? Any ideas what I'm doing wrong here??</p>