5

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 ?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
a3adel
  • 1,223
  • 4
  • 15
  • 26

1 Answers1

3

"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+

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491