CameraXConfig


class CameraXConfig


A configuration for adding implementation and user-specific behavior to CameraX.

CameraXConfig provides customizable options for camera provider instances that persist for the lifetime of the provider.

An implementation of CameraXConfig can be provided by subclassing the Application object and implementing CameraXConfig.Provider. Alternatively, other methods configuration exist such as configureInstance. Examples of how this is used can be found in the androidx.camera.lifecycle package.

Applications can create and use the implementation of CameraXConfig provided in androidx.camera.camera2.

Summary

Nested types

A builder for generating CameraXConfig objects.

An interface which can be implemented to provide the configuration for CameraX.

Public functions

CameraSelector?

Returns the CameraSelector used to determine the available cameras.

Executor?
getCameraExecutor(valueIfMissing: Executor?)

Returns the camera executor which CameraX will use to drive the camera stack.

Long

Returns the camera open retry maximum timeout in milliseconds when in active resuming mode.

RetryPolicy

Retrieves the RetryPolicy for the CameraProvider initialization.

Int

Returns the minimum logging level to be used for CameraX logs.

Handler?
getSchedulerHandler(valueIfMissing: Handler?)

Returns the scheduling handler that CameraX will use internally for scheduling future tasks.

Public functions

getAvailableCamerasLimiter

Added in 1.1.0
fun getAvailableCamerasLimiter(valueIfMissing: CameraSelector?): CameraSelector?

Returns the CameraSelector used to determine the available cameras.

getCameraExecutor

Added in 1.1.0
fun getCameraExecutor(valueIfMissing: Executor?): Executor?

Returns the camera executor which CameraX will use to drive the camera stack.

getCameraOpenRetryMaxTimeoutInMillisWhileResuming

Added in 1.4.0
fun getCameraOpenRetryMaxTimeoutInMillisWhileResuming(): Long

Returns the camera open retry maximum timeout in milliseconds when in active resuming mode.

If this value is not set, -1L will be returned by default.

getCameraProviderInitRetryPolicy

Added in 1.4.0
@ExperimentalRetryPolicy
fun getCameraProviderInitRetryPolicy(): RetryPolicy

Retrieves the RetryPolicy for the CameraProvider initialization. This policy determines whether to retry the CameraProvider initialization if it fails.

Returns
RetryPolicy

The RetryPolicy to be used for the CameraProvider initialization. If not explicitly set, it defaults to DEFAULT.

getMinimumLoggingLevel

Added in 1.0.0
fun getMinimumLoggingLevel(): Int

Returns the minimum logging level to be used for CameraX logs.

getSchedulerHandler

Added in 1.1.0
fun getSchedulerHandler(valueIfMissing: Handler?): Handler?

Returns the scheduling handler that CameraX will use internally for scheduling future tasks.