Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera2 API Android min SDK [duplicate]

Hello I am trying to develop an application that uses a custom Camera, when I try to use the Camera class it was deprecated so I have used android hardware. Camera 2 and followed this tutorial

but when I try to add CameraDevice.StatecCallBack it gives me a warning that the min SDK should be 21 and my min SDK is 15 Now I'm confused if I used the old Camera API its deprecated if i used the new one it doesn't support my min SDK what should I do ?

like image 580
a3adel Avatar asked Oct 18 '22 03:10

a3adel


1 Answers

"Deprecated" in Android usually means "we have something else that you should consider using". Deprecated classes and methods usually still work, and on older Android devices often times you have no choice but to use them.

So, your options are:

  1. Use android.hardware.Camera all the time, or

  2. Use android.hardware.Camera for devices running older than API Level 21, then use android.hardware.camera2.* for devices running API Level 21+

like image 177
CommonsWare Avatar answered Oct 30 '22 00:10

CommonsWare