Android Camera 2 API

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Parameters

ParameterDetails
CameraCaptureSessionA configured capture session for a CameraDevice, used for capturing images from the camera or reprocessing images captured from the camera in the same session previously
CameraDeviceA representation of a single camera connected to an Android device
CameraCharacteristicsThe properties describing a CameraDevice. These properties are fixed for a given CameraDevice, and can be queried through the CameraManager interface with getCameraCharacteristics(String)
CameraManagerA system service manager for detecting, characterizing, and connecting to CameraDevices. You can get an instance of this class by calling Context.getSystemService()
CaptureRequestAn immutable package of settings and outputs needed to capture a single image from the camera device. Contains the configuration for the capture hardware (sensor, lens, flash), the processing pipeline, the control algorithms, and the output buffers. Also contains the list of target Surfaces to send image data to for this capture. Can be created by using a CaptureRequest.Builder instance, obtained by calling createCaptureRequest(int)
CaptureResultThe subset of the results of a single image capture from the image sensor. Contains a subset of the final configuration for the capture hardware (sensor, lens, flash), the processing pipeline, the control algorithms, and the output buffers. It is produced by a CameraDevice after processing a CaptureRequest

Remarks

  • Camera2 APIs are available in API 21+ (Lollipop and beyond)
  • Even if an Android device has a 21+ ROM officially, there is no guarantee that it implements Camera2 APIs, it's totally up to the manufacturer to implement it or not (Example: LG G2 has official Lollipop support, but no Camera2 APIs)
  • With Camera2, Camera ("Camera1") is deprecated
  • With great power comes great responsability: It's easier to mess it up when using this APIs.
  • Remember, if you only want to take a photo in your app, and simply get it, you don't need to implement Camera2, you can open the device's camera app via an Intent, and receive it back


Got any Android Question?