androidandroid-cameraandroid-camera2android-5.1.1-lollipopandroid-camerax

Which Android Camera API should I use


I have a requirement to implement an in application camera behavior where a user can take a picture of a QR Code and then I will use Google Play services API to process and decode the QR Code.

So all I need to do is take a picture.

Furthermore, I know the exact device models that this app is being deployed to. Currently it is two devices, eventually, it might be three device models (all API 21+).

From what I have read, the Jetpack CameraX API is developed to simplify device specific code.

If my goal is to just implement the most straightforward code for this requirement... should I look at using the Camera API, or Camera2 API, or CameraX API?


Solution

  • Actually CameraX is just a wrapper about the Camera2 API. Read following article

    In your case which is quite simplistic, taking a photo can be done by many libraries such as

    QR Code Reader

    But if you still want to develop taking picture functionality and your devices are 21+, I would suggest you go for CameraX, since it will be updated very frequently and you wont have to worry about different behavior in different devices as explained in this video on YouTube