The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications.
The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications.
Official Android Camera documentation
To access the device camera, you must declare the CAMERA permission in your Android Manifest. Also be sure to include the manifest element to declare camera features used by your application. For example, if you use the camera and auto-focus feature, your Manifest should include the following:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
The Android framework supports capturing images and video through the Camera API or camera Intent.
- Camera This class is the primary API for controlling device cameras. This class is used to take pictures or videos when you are building a camera application.
- SurfaceView This class is used to present a live camera preview to the user.
- MediaRecorder This class is used to record video from the camera.
- Intent An intent action type of MediaStore.ACTION_IMAGE_CAPTURE or MediaStore.ACTION_VIDEO_CAPTURE can be used to capture images or videos without directly using the Camera object.
The Camera class has been deprecated. It is recommend using the newer class camera2, which works on Android 5.0 (API level 21) or greater.
You can read more about camera2 on Android Official blog. For questions specifically related to camera2, use android-camera2.