CameraXConfig


public final 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

public final class CameraXConfig.Builder

A builder for generating CameraXConfig objects.

public interface CameraXConfig.Provider

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

Public methods

@Nullable CameraSelector

Returns the CameraSelector used to determine the available cameras.

@Nullable 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.

@NonNull RetryPolicy

Retrieves the RetryPolicy for the CameraProvider initialization.

int

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

@Nullable Handler

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

Public methods

getAvailableCamerasLimiter

Added in 1.1.0
public @Nullable CameraSelector getAvailableCamerasLimiter(@Nullable CameraSelector valueIfMissing)

Returns the CameraSelector used to determine the available cameras.

getCameraExecutor

Added in 1.1.0
public @Nullable Executor getCameraExecutor(@Nullable Executor valueIfMissing)

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

getCameraOpenRetryMaxTimeoutInMillisWhileResuming

Added in 1.4.0
public long getCameraOpenRetryMaxTimeoutInMillisWhileResuming()

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
public @NonNull RetryPolicy getCameraProviderInitRetryPolicy()

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

Returns
@NonNull RetryPolicy

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

getMinimumLoggingLevel

Added in 1.0.0
public int getMinimumLoggingLevel()

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

getSchedulerHandler

Added in 1.1.0
public @Nullable Handler getSchedulerHandler(@Nullable Handler valueIfMissing)

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