Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of camera2 versus deprecated Camera - what is best practice?

I'm writing an app for which the camera is an essential feature. In this regard I want to be 100% certain about the following aspects:

  1. If I use the deprecated camera: will the app still run on all APIs now?
  2. If 1) is yes: At what point in time this app will not run anymore on all APIs (my app shall cover minimum API 17) ?
  3. Where can I find updated official information about 2), i.e. what is planned and by when?
  4. Say, I would use the new camera2 already now, my understanding is that the app would not run on any API below 21 - correct?
  5. My working hypothesis from the information I got so far is: NOW still use the the deprecated Camera. But Keep watching market shares of APIs and start learning camera2 soon, in order to be ready to switch the app to camera2 within the next 2-3 years. Do you agree?

In any case, the use of a device's camera and making it run on virtually all targeted devices is tricky enough (as for now I am happy to have mastered the "old" Camera...). Therefore, I really want to be sure about the above points. Many thanks for your answers.

like image 346
Settembrini Avatar asked Sep 13 '15 13:09

Settembrini


People also ask

What is difference between CameraX and Camera2?

Camera 2 is the framework API that is included in Android since Android 5.0 Lollipop, and CameraX is a Jetpack support library that runs on top of Camera 2, and is available to all Android developers. These solutions are meant to complement each other in addressing the needs of the Android Camera ecosystem.

What is the use of Camera2 API?

Camera2 is the latest low-level Android camera package and replaces the deprecated Camera class. Camera2 provides in-depth controls for complex use cases, but requires you to manage device-specific configurations. You can read about specific Camera2 classes and functions in the reference documentation.

What is Level 3 Camera2 API?

Full: These devices support all of the major capabilities of Camera API2 and must use Camera HAL 3.2 or higher and Android 5.0 or higher. Level_3: These devices support YUV reprocessing and RAW image capture, along with additional output stream configurations on top of full Camera2 API support.

How do I know if my Camera2 supports API?

Well, all you need to do is download a simple app called 'Camera2 API probe' from the Google Play Store and run it. The app gives detailed info about both the rear and front camera sensors of your Android phone. From that info, you can easily deduce whether your Android device supports Camera2 API or not.


1 Answers

If I use the deprecated camera: will the app still run on all APIs now?

Yes.

At what point in time this app will not run anymore on all APIs (my app shall cover minimum API 17) ?

Build a time machine, go into the future, find out, and let the rest of us know.

IOW, we have no way of predicting if and when Google might discontinue this API entirely. That being said, they almost never discontinue APIs.

Where can I find updated official information about 2), i.e. what is planned and by when?

Get a job with Google, or go with the aforementioned time machine option. Google is not in the habit of announcing plans in advance, and their time machine is not available for rental.

(though Elon Musk probably has a Tesla outfitted with a Mr. Fusion, so you could reach out to him...)

I would use the new camera2 already now, my understanding is that the app would not run on any API below 21 - correct?

Correct.

NOW still use the the deprecated Camera. But Keep watching market shares of APIs and start learning camera2 soon, in order to be ready to switch the app to camera2 within the next 2-3 years. Do you agree?

No, for reasons I will clarify after your next quote.

the use of a device's camera and making it run on virtually all targeted devices is tricky enough

Part of that trickiness is the fact that device manufacturers have camera implementations that might be generously described as "quirky".

The problem with sticking with the old camera API exclusively is that I expect quality control on that API to steadily decline. What limited resources device manufacturers have for cameras primarily will be devoted to the new API.

Hence, my recommendation is to use both APIs: using camera2 where possible and falling back to the original API where needed. Admittedly, this requires substantially more work. If you are not in position to do that work, then you have no choice but to stick with the original camera API until such time as you are ready to have your minSdkVersion be 21+.

like image 149
CommonsWare Avatar answered Sep 21 '22 17:09

CommonsWare