public final class ProcessCameraProvider
extends Object implements CameraProvider


A singleton which can be used to bind the lifecycle of cameras to any LifecycleOwner within an application's process.

Only a single process camera provider can exist within a process, and it can be retrieved with getInstance(Context).

Heavyweight resources, such as open and running camera devices, will be scoped to the lifecycle provided to bindToLifecycle(LifecycleOwner, CameraSelector, UseCase). Other lightweight resources, such as static camera characteristics, may be retrieved and cached upon first retrieval of this provider with getInstance(Context), and will persist for the lifetime of the process.

This is the standard provider for applications to use.


Public methods

Camera bindToLifecycle(LifecycleOwner lifecycleOwner, CameraSelector cameraSelector, UseCase... useCases)

Binds the collection of UseCase to a LifecycleOwner.

Camera bindToLifecycle(LifecycleOwner lifecycleOwner, CameraSelector cameraSelector, UseCaseGroup useCaseGroup)

Binds a UseCaseGroup to a LifecycleOwner.

static void configureInstance(CameraXConfig cameraXConfig)

Perform one-time configuration of the ProcessCameraProvider singleton with the given CameraXConfig.

List<CameraInfo> getAvailableCameraInfos()

Returns CameraInfo instances of the available cameras.

static ListenableFuture<ProcessCameraProvider> getInstance(Context context)

Retrieves the ProcessCameraProvider associated with the current process.

boolean hasCamera(