Skip to content Skip to sidebar Skip to footer

Android: Determining Number Of Cameras On 2.2 And Above

My app needs to run on Android 2.2 and above. I need a way to determine the number of cameras available. There are a number of posts addressing this but I couldn't find one that wo

Solution 1:

Multiple cameras are not supported on earlier OS versions, so you can just assume you have 1. even the device had 2, they are not supported by the standard Android API. For newer OS versions, just use the Camera.getNumberOfCameras() and Camera.getCameraInfo() with an API level guard statement:

 int numCameras = 1;
 if (Build.Version.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
   numCameras = Camera.getNumberOfCameras();
 }

Post a Comment for "Android: Determining Number Of Cameras On 2.2 And Above"