Configuration

class Configuration


The Configuration object used to customize WorkManager upon initialization. Configuration contains various parameters used to setup WorkManager. For example, it is possible to customize the Executor used by Workers here.

To set a custom Configuration for WorkManager, see WorkManager.initialize.

Summary

Nested types

A Builder for Configurations.

A class that can provide the Configuration for WorkManager and allow for on-demand initialization of WorkManager.

Constants

const Int

The minimum number of system requests which can be enqueued by WorkManager when using android.app.job.JobScheduler or android.app.AlarmManager.

Public properties

Clock

The Clock used by WorkManager to calculate schedules and perform book-keeping.

Int

Maximum number of Workers with Constraints.contentUriTriggers that could be enqueued simultaneously.

String?

The String name of the process where work should be scheduled.

Executor

The Executor used by WorkManager to execute Workers.

Consumer<Throwable>?

The exception handler that is used to intercept exceptions caused when trying to initialize WorkManager.

InputMergerFactory

The InputMergerFactory used by WorkManager to create instances of InputMergers.

Int

The last valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.

Int

The first valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.

RunnableScheduler

The RunnableScheduler to keep track of timed work in the in-process scheduler.

Consumer<Throwable>?

The exception handler that can be used to intercept exceptions caused when trying to schedule WorkRequests.

Executor

The Executor used by WorkManager for all its internal business logic

WorkerFactory

The WorkerFactory used by WorkManager to create ListenableWorkers

Constants

MIN_SCHEDULER_LIMIT

const val MIN_SCHEDULER_LIMIT = 20: Int

The minimum number of system requests which can be enqueued by WorkManager when using android.app.job.JobScheduler or android.app.AlarmManager.

Public properties

clock

Added in 2.9.0
val clockClock

The Clock used by WorkManager to calculate schedules and perform book-keeping.

contentUriTriggerWorkersLimit

Added in 2.9.0
val contentUriTriggerWorkersLimitInt

Maximum number of Workers with Constraints.contentUriTriggers that could be enqueued simultaneously.

Unlike the other workers Workers with Constraints.contentUriTriggers must immediately occupy slots in JobScheduler to avoid missing updates, thus they are separated in the its own category.

defaultProcessName

Added in 2.5.0
val defaultProcessNameString?

The String name of the process where work should be scheduled.

executor

Added in 1.0.0
val executorExecutor

The Executor used by WorkManager to execute Workers.

initializationExceptionHandler

Added in 2.8.0
val initializationExceptionHandlerConsumer<Throwable>?

The exception handler that is used to intercept exceptions caused when trying to initialize WorkManager.

inputMergerFactory

Added in 2.3.0
val inputMergerFactoryInputMergerFactory

The InputMergerFactory used by WorkManager to create instances of InputMergers.

maxJobSchedulerId

Added in 1.0.0
val maxJobSchedulerIdInt

The last valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.

If the current jobId goes beyond the bounds of the defined range of (Configuration.minJobSchedulerId, Configuration.maxJobSchedulerId), it is reset to (Configuration.minJobSchedulerId).

minJobSchedulerId

Added in 1.0.0
val minJobSchedulerIdInt

The first valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.

If the current jobId goes beyond the bounds of the defined range of (Configuration.minJobSchedulerId, Configuration.maxJobSchedulerId), it is reset to (Configuration.minJobSchedulerId).

runnableScheduler

Added in 2.4.0
val runnableSchedulerRunnableScheduler

The RunnableScheduler to keep track of timed work in the in-process scheduler.

schedulingExceptionHandler

Added in 2.8.0
val schedulingExceptionHandlerConsumer<Throwable>?

The exception handler that can be used to intercept exceptions caused when trying to schedule WorkRequests.

taskExecutor

Added in 2.1.0
val taskExecutorExecutor

The Executor used by WorkManager for all its internal business logic

workerFactory

Added in 1.0.0
val workerFactoryWorkerFactory

The WorkerFactory used by WorkManager to create ListenableWorkers