# Configuration

Artifact: [androidx.work:work-runtime](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/Configuration.kt+class:androidx.work.Configuration) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

*** ** * ** ***


```
class Configuration
```

<br />

*** ** * ** ***

The Configuration object used to customize `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` upon initialization. Configuration contains various parameters used to setup WorkManager. For example, it is possible to customize the `https://developer.android.com/reference/java/util/concurrent/Executor.html` used by `https://developer.android.com/reference/kotlin/androidx/work/Worker`s here.

To set a custom Configuration for WorkManager, see `https://developer.android.com/reference/kotlin/androidx/work/WorkManager#initialize(android.content.Context,androidx.work.Configuration)`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` A Builder for `https://developer.android.com/reference/kotlin/androidx/work/Configuration`s. |
| `interface https://developer.android.com/reference/kotlin/androidx/work/Configuration.Provider` A class that can provide the `https://developer.android.com/reference/kotlin/androidx/work/Configuration` for WorkManager and allow for on-demand initialization of WorkManager. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#MIN_SCHEDULER_LIMIT() = 20` The minimum number of system requests which can be enqueued by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when using `https://developer.android.com/reference/android/app/job/JobScheduler.html` or `https://developer.android.com/reference/android/app/AlarmManager.html`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener?` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalEventsApi https://developer.android.com/reference/kotlin/androidx/work/Configuration#getExecutionEventListener()()` The `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` that listens to work execution events for all workers. |
| `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener?` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalEventsApi https://developer.android.com/reference/kotlin/androidx/work/Configuration#getScheduleEventListener()()` The `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` that listens to work execution events for all workers. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalConfigurationApi https://developer.android.com/reference/kotlin/androidx/work/Configuration#isGreedySchedulerEnabled()()` Specifies whether the in-process opportunistic greedy scheduler is enabled |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalConfigurationApi https://developer.android.com/reference/kotlin/androidx/work/Configuration#isMarkingJobsAsImportantWhileForeground()()` Specifies whether WorkManager automatically set `https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setImportantWhileForeground(boolean)` for workers that are eligible to run immediately. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Clock` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#clock()` The `https://developer.android.com/reference/kotlin/androidx/work/Clock` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to calculate schedules and perform book-keeping. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#contentUriTriggerWorkersLimit()` Maximum number of Workers with `https://developer.android.com/reference/kotlin/androidx/work/Constraints#contentUriTriggers()` that could be enqueued simultaneously. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#defaultProcessName()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` name of the process where work should be scheduled. |
| `https://developer.android.com/reference/java/util/concurrent/Executor.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#executor()` The `https://developer.android.com/reference/java/util/concurrent/Executor.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to execute `https://developer.android.com/reference/kotlin/androidx/work/Worker`s. |
| `https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#initializationExceptionHandler()` The exception handler that is used to intercept exceptions caused when trying to initialize `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`. |
| `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#inputMergerFactory()` The `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to create instances of `https://developer.android.com/reference/kotlin/androidx/work/InputMerger`s. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#maxJobSchedulerId()` The last valid id (inclusive) used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when creating new instances of `https://developer.android.com/reference/android/app/job/JobInfo.html`s. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#minJobSchedulerId()` The first valid id (inclusive) used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when creating new instances of `https://developer.android.com/reference/android/app/job/JobInfo.html`s. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 1200000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#remoteSessionTimeoutMillis()` The time in milliseconds that the designated process stays active before unbinding when using `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager`. |
| `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#runnableScheduler()` The `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` to keep track of timed work in the in-process scheduler. |
| `https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#schedulingExceptionHandler()` The exception handler that can be used to intercept exceptions caused when trying to schedule `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`s. |
| `https://developer.android.com/reference/java/util/concurrent/Executor.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()` The `https://developer.android.com/reference/java/util/concurrent/Executor.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` for all its internal business logic |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#workerCoroutineContext()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to execute `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker`s. |
| `https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo>?` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#workerExecutionExceptionHandler()` The exception handler that can be used to intercept exceptions caused when trying to execute `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s. |
| `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#workerFactory()` The `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to create `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s |
| `https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo>?` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration#workerInitializationExceptionHandler()` The exception handler that can be used to intercept exceptions caused when trying to initialize `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s. |

## Constants

### MIN_SCHEDULER_LIMIT

```
const val MIN_SCHEDULER_LIMIT = 20: Int
```

The minimum number of system requests which can be enqueued by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when using `https://developer.android.com/reference/android/app/job/JobScheduler.html` or `https://developer.android.com/reference/android/app/AlarmManager.html`.

## Public functions

### getExecutionEventListener

Added in [2.12.0](https://developer.android.com/jetpack/androidx/releases/work#2.12.0)

```
@ExperimentalEventsApi
fun getExecutionEventListener(): ExecutionEventListener?
```

The `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` that listens to work execution events for all workers.

### getScheduleEventListener

Added in [2.12.0](https://developer.android.com/jetpack/androidx/releases/work#2.12.0)

```
@ExperimentalEventsApi
fun getScheduleEventListener(): ScheduleEventListener?
```

The `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` that listens to work execution events for all workers.

### isGreedySchedulerEnabled

Added in [2.12.0](https://developer.android.com/jetpack/androidx/releases/work#2.12.0)

```
@ExperimentalConfigurationApi
fun isGreedySchedulerEnabled(): Boolean
```

Specifies whether the in-process opportunistic greedy scheduler is enabled

This is enabled by default and should only be disabled for experimental purposes.

### isMarkingJobsAsImportantWhileForeground

Added in [2.10.0](https://developer.android.com/jetpack/androidx/releases/work#2.10.0)

```
@ExperimentalConfigurationApi
fun isMarkingJobsAsImportantWhileForeground(): Boolean
```

Specifies whether WorkManager automatically set `https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setImportantWhileForeground(boolean)` for workers that are eligible to run immediately.

## Public properties

### clock

Added in [2.9.0](https://developer.android.com/jetpack/androidx/releases/work#2.9.0)

```
val clock: Clock
```

The `https://developer.android.com/reference/kotlin/androidx/work/Clock` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to calculate schedules and perform book-keeping.

### contentUriTriggerWorkersLimit

Added in [2.9.0](https://developer.android.com/jetpack/androidx/releases/work#2.9.0)

```
val contentUriTriggerWorkersLimit: Int
```

Maximum number of Workers with `https://developer.android.com/reference/kotlin/androidx/work/Constraints#contentUriTriggers()` that could be enqueued simultaneously.

Unlike the other workers Workers with `https://developer.android.com/reference/kotlin/androidx/work/Constraints#contentUriTriggers()` must immediately occupy slots in JobScheduler to avoid missing updates, thus they are separated in its own category.

### defaultProcessName

Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/work#2.5.0)

```
val defaultProcessName: String?
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` name of the process where work should be scheduled.

### executor

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
val executor: Executor
```

The `https://developer.android.com/reference/java/util/concurrent/Executor.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to execute `https://developer.android.com/reference/kotlin/androidx/work/Worker`s.

### initializationExceptionHandler

Added in [2.8.0](https://developer.android.com/jetpack/androidx/releases/work#2.8.0)

```
val initializationExceptionHandler: Consumer<Throwable>?
```

The exception handler that is used to intercept exceptions caused when trying to initialize `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`.

### inputMergerFactory

Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/work#2.3.0)

```
val inputMergerFactory: InputMergerFactory
```

The `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to create instances of `https://developer.android.com/reference/kotlin/androidx/work/InputMerger`s.

### maxJobSchedulerId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
val maxJobSchedulerId: Int
```

The last valid id (inclusive) used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when creating new instances of `https://developer.android.com/reference/android/app/job/JobInfo.html`s.

If the current `jobId` goes beyond the bounds of the defined range of (`https://developer.android.com/reference/kotlin/androidx/work/Configuration#minJobSchedulerId()`, `https://developer.android.com/reference/kotlin/androidx/work/Configuration#maxJobSchedulerId()`), it is reset to (`https://developer.android.com/reference/kotlin/androidx/work/Configuration#minJobSchedulerId()`).

### minJobSchedulerId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
val minJobSchedulerId: Int
```

The first valid id (inclusive) used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` when creating new instances of `https://developer.android.com/reference/android/app/job/JobInfo.html`s.

If the current `jobId` goes beyond the bounds of the defined range of (`https://developer.android.com/reference/kotlin/androidx/work/Configuration#minJobSchedulerId()`, `https://developer.android.com/reference/kotlin/androidx/work/Configuration#maxJobSchedulerId()`), it is reset to (`https://developer.android.com/reference/kotlin/androidx/work/Configuration#minJobSchedulerId()`).

### remoteSessionTimeoutMillis

Added in [2.11.0](https://developer.android.com/jetpack/androidx/releases/work#2.11.0)

```
val remoteSessionTimeoutMillis: @IntRange(from = 0, to = 1200000) Long
```

The time in milliseconds that the designated process stays active before unbinding when using `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager`.

The default timeout is `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager#DEFAULT_SESSION_TIMEOUT_MILLIS()`.

### runnableScheduler

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/work#2.4.0)

```
val runnableScheduler: RunnableScheduler
```

The `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` to keep track of timed work in the in-process scheduler.

### schedulingExceptionHandler

Added in [2.8.0](https://developer.android.com/jetpack/androidx/releases/work#2.8.0)

```
val schedulingExceptionHandler: Consumer<Throwable>?
```

The exception handler that can be used to intercept exceptions caused when trying to schedule `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`s.

### taskExecutor

Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/work#2.1.0)

```
val taskExecutor: Executor
```

The `https://developer.android.com/reference/java/util/concurrent/Executor.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` for all its internal business logic

### workerCoroutineContext

Added in [2.10.0](https://developer.android.com/jetpack/androidx/releases/work#2.10.0)

```
val workerCoroutineContext: CoroutineContext
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to execute `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker`s.

### workerExecutionExceptionHandler

Added in [2.10.0](https://developer.android.com/jetpack/androidx/releases/work#2.10.0)

```
val workerExecutionExceptionHandler: Consumer<WorkerExceptionInfo>?
```

The exception handler that can be used to intercept exceptions caused when trying to execute `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s.

### workerFactory

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
val workerFactory: WorkerFactory
```

The `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` to create `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s

### workerInitializationExceptionHandler

Added in [2.10.0](https://developer.android.com/jetpack/androidx/releases/work#2.10.0)

```
val workerInitializationExceptionHandler: Consumer<WorkerExceptionInfo>?
```

The exception handler that can be used to intercept exceptions caused when trying to initialize `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s.