# Configuration.Builder

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.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

*** ** * ** ***


```
class Configuration.Builder
```

<br />

*** ** * ** ***

A Builder for `https://developer.android.com/reference/kotlin/androidx/work/Configuration`s.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#Builder()()` Creates a new `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#build()()` Builds a `https://developer.android.com/reference/kotlin/androidx/work/Configuration` object. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setClock(androidx.work.Clock)(clock: https://developer.android.com/reference/kotlin/androidx/work/Clock)` Sets a `https://developer.android.com/reference/kotlin/androidx/work/Clock` for WorkManager to calculate schedules and perform book-keeping. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setContentUriTriggerWorkersLimit(kotlin.Int)(contentUriTriggerWorkersLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the maximum number of Workers with `https://developer.android.com/reference/kotlin/androidx/work/Constraints#contentUriTriggers()` that could be enqueued simultaneously. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setDefaultProcessName(kotlin.String)(processName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Designates the primary process that `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` should schedule work in. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalEventsApi https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setExecutionEventListener(androidx.work.ExecutionEventListener)(listener: https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener)` Set a `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` to run whenever work execution events occur for any worker. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html)` Specifies a custom `https://developer.android.com/reference/java/util/concurrent/Executor.html` to run `https://developer.android.com/reference/kotlin/androidx/work/Worker#doWork()`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalConfigurationApi https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setGreedySchedulerEnabled(kotlin.Boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Specifies whether the in-process opportunistic greedy scheduler should be enabled. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setInitializationExceptionHandler(androidx.core.util.Consumer)( exceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html> )` Specifies a `Consumer<Throwable>` that can be used to intercept exceptions caused when trying to initialize {@link WorkManager}, that usually happens when WorkManager cannot access its internal datastore. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setInputMergerFactory(androidx.work.InputMergerFactory)(inputMergerFactory: https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory)` Specifies a custom `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` for WorkManager. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setJobSchedulerJobIdRange(kotlin.Int,kotlin.Int)(minJobSchedulerId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxJobSchedulerId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the range of `https://developer.android.com/reference/android/app/job/JobInfo.html` IDs that can be used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalConfigurationApi https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setMarkingJobsAsImportantWhileForeground(kotlin.Boolean)(markAsImportant: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Regulates whether WorkManager should automatically set `https://developer.android.com/reference/android/app/job/JobInfo.Builder.html#setImportantWhileForeground(boolean)` for workers that are eligible to run immediately. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setMaxSchedulerLimit(kotlin.Int)(maxSchedulerLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the maximum number of system requests made 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`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setMinimumLoggingLevel(kotlin.Int)(loggingLevel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the minimum logging level, corresponding to the constants found in `https://developer.android.com/reference/android/util/Log.html`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setRemoteSessionTimeoutMillis(kotlin.Long)( timeoutMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 1200000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Set how long in milliseconds that a `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager` binding to the designated process stays active before timing out and unbinding. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setRunnableScheduler(androidx.work.RunnableScheduler)(runnableScheduler: https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler)` Specifies the `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` to be used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `@https://developer.android.com/reference/kotlin/androidx/work/ExperimentalEventsApi https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setScheduleEventListener(androidx.work.ScheduleEventListener)(listener: https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener)` Set a `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` to run whenever work scheduling events occur for any worker. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setSchedulingExceptionHandler(androidx.core.util.Consumer)( schedulingExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html> )` Specifies a `Consumer<Throwable>` 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/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setTaskExecutor(java.util.concurrent.Executor)(taskExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html)` Specifies a `https://developer.android.com/reference/java/util/concurrent/Executor.html` which will be used by WorkManager for all its internal book-keeping. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerCoroutineContext(kotlin.coroutines.CoroutineContext)(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html)` Specifies a custom `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` to run `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker#doWork()`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerExecutionExceptionHandler(androidx.core.util.Consumer)( workerExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo> )` Specifies a `WorkerExceptionHandler` 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/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerFactory(androidx.work.WorkerFactory)(workerFactory: https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory)` Specifies a custom `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` for WorkManager. |
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerInitializationExceptionHandler(androidx.core.util.Consumer)( workerExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo> )` Specifies a `WorkerExceptionHandler` that can be used to intercept exceptions caused when trying to initialize `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s. |

## Public constructors

### Builder

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

```
Builder()
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder`.

## Public functions

### build

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

```
fun build(): Configuration
```

Builds a `https://developer.android.com/reference/kotlin/androidx/work/Configuration` object.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration` | A `https://developer.android.com/reference/kotlin/androidx/work/Configuration` object with this `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder`'s parameters. |

### setClock

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

```
fun setClock(clock: Clock): Configuration.Builder
```

Sets a `https://developer.android.com/reference/kotlin/androidx/work/Clock` for WorkManager to calculate schedules and perform book-keeping.

This should only be overridden for testing. It must return the same value as `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` in production code.

| Parameters |
|---|---|
| `clock: https://developer.android.com/reference/kotlin/androidx/work/Clock` | The `https://developer.android.com/reference/kotlin/androidx/work/Clock` to use |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setContentUriTriggerWorkersLimit

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

```
fun setContentUriTriggerWorkersLimit(contentUriTriggerWorkersLimit: Int): Configuration.Builder
```

Specifies the 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.

### setDefaultProcessName

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

```
fun setDefaultProcessName(processName: String): Configuration.Builder
```

Designates the primary process that `https://developer.android.com/reference/kotlin/androidx/work/WorkManager` should schedule work in.

| Parameters |
|---|---|
| `processName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` process name. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setExecutionEventListener

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

```
@ExperimentalEventsApi
fun setExecutionEventListener(listener: ExecutionEventListener): Configuration.Builder
```

Set a `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` to run whenever work execution events occur for any worker.

These callbacks will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` | `https://developer.android.com/reference/kotlin/androidx/work/ExecutionEventListener` to set |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setExecutor

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

```
fun setExecutor(executor: Executor): Configuration.Builder
```

Specifies a custom `https://developer.android.com/reference/java/util/concurrent/Executor.html` to run `https://developer.android.com/reference/kotlin/androidx/work/Worker#doWork()`.

If `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerCoroutineContext(kotlin.coroutines.CoroutineContext)` wasn't called then the `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setExecutor(java.util.concurrent.Executor)` will be used as `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to run `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker` as well.

| Parameters |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | An `https://developer.android.com/reference/java/util/concurrent/Executor.html` for running `https://developer.android.com/reference/kotlin/androidx/work/Worker`s |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setGreedySchedulerEnabled

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

```
@ExperimentalConfigurationApi
fun setGreedySchedulerEnabled(enabled: Boolean): Configuration.Builder
```

Specifies whether the in-process opportunistic greedy scheduler should be enabled.

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

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether to enable the greedy scheduler |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setInitializationExceptionHandler

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

```
fun setInitializationExceptionHandler(
    exceptionHandler: Consumer<Throwable>
): Configuration.Builder
```

Specifies a `Consumer<Throwable>` that can be used to intercept exceptions caused when trying to initialize {@link WorkManager}, that usually happens when WorkManager cannot access its internal datastore.

This exception handler will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `exceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>` | an instance to handle exceptions |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setInputMergerFactory

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

```
fun setInputMergerFactory(inputMergerFactory: InputMergerFactory): Configuration.Builder
```

Specifies a custom `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` for WorkManager.

| Parameters |
|---|---|
| `inputMergerFactory: https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` | A `https://developer.android.com/reference/kotlin/androidx/work/InputMergerFactory` for creating `https://developer.android.com/reference/kotlin/androidx/work/InputMerger`s |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setJobSchedulerJobIdRange

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

```
fun setJobSchedulerJobIdRange(minJobSchedulerId: Int, maxJobSchedulerId: Int): Configuration.Builder
```

Specifies the range of `https://developer.android.com/reference/android/app/job/JobInfo.html` IDs that can be used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`. WorkManager needs a range of at least `1000` IDs.

JobScheduler uses integers as identifiers for jobs, and WorkManager delegates to JobScheduler on certain API levels. In order to not clash job codes used in the rest of your app, you can use this method to tell WorkManager the valid range of job IDs that it can use.

The default values are `0` and `Integer#MAX_VALUE`.

| Parameters |
|---|---|
| `minJobSchedulerId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The first valid `https://developer.android.com/reference/android/app/job/JobInfo.html` ID (inclusive). |
| `maxJobSchedulerId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The last valid `https://developer.android.com/reference/android/app/job/JobInfo.html` ID (inclusive). |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | when the size of the range is less than 1000 |

### setMarkingJobsAsImportantWhileForeground

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

```
@ExperimentalConfigurationApi
fun setMarkingJobsAsImportantWhileForeground(markAsImportant: Boolean): Configuration.Builder
```

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

It will have effects only on API levels \>= 23.

| Parameters |
|---|---|
| `markAsImportant: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether to mark jobs as important |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setMaxSchedulerLimit

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

```
fun setMaxSchedulerLimit(maxSchedulerLimit: Int): Configuration.Builder
```

Specifies the maximum number of system requests made 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`.

By default, WorkManager might schedule a large number of alarms or JobScheduler jobs. If your app uses JobScheduler or AlarmManager directly, this might exhaust the OS-enforced limit on the number of jobs or alarms an app is allowed to schedule. To help manage this situation, you can use this method to reduce the number of underlying jobs and alarms that WorkManager might schedule.

When the application exceeds this limit, WorkManager maintains an internal queue of `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`s, and schedules them when slots become free.

WorkManager requires a minimum of `https://developer.android.com/reference/kotlin/androidx/work/Configuration#MIN_SCHEDULER_LIMIT()` slots; this is also the default value. The total number of slots also cannot exceed `50`.

| Parameters |
|---|---|
| `maxSchedulerLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The total number of jobs 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`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `maxSchedulerLimit` is less than `https://developer.android.com/reference/kotlin/androidx/work/Configuration#MIN_SCHEDULER_LIMIT()` |

### setMinimumLoggingLevel

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

```
fun setMinimumLoggingLevel(loggingLevel: Int): Configuration.Builder
```

Specifies the minimum logging level, corresponding to the constants found in `https://developer.android.com/reference/android/util/Log.html`. For example, specifying `https://developer.android.com/reference/android/util/Log.html#VERBOSE` will log everything, whereas specifying `https://developer.android.com/reference/android/util/Log.html#ERROR` will only log errors and assertions.The default value is `https://developer.android.com/reference/android/util/Log.html#INFO`.

| Parameters |
|---|---|
| `loggingLevel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The minimum logging level, corresponding to the constants found in `https://developer.android.com/reference/android/util/Log.html` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setRemoteSessionTimeoutMillis

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

```
fun setRemoteSessionTimeoutMillis(
    timeoutMillis: @IntRange(from = 0, to = 1200000) Long
): Configuration.Builder
```

Set how long in milliseconds that a `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager` binding to the designated process stays active before timing out and unbinding.

The default timeout is `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager#DEFAULT_SESSION_TIMEOUT_MILLIS()` and can be configured up to `https://developer.android.com/reference/kotlin/androidx/work/multiprocess/RemoteWorkManager#MAX_SESSION_TIMEOUT_MILLIS()`. A timeout of 0 will unbind immediately after each call.

| Parameters |
|---|---|
| `timeoutMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 1200000) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Timeout in milliseconds before the session unbinds |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setRunnableScheduler

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

```
fun setRunnableScheduler(runnableScheduler: RunnableScheduler): Configuration.Builder
```

Specifies the `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` to be used by `https://developer.android.com/reference/kotlin/androidx/work/WorkManager`.

This is used by the in-process scheduler to keep track of timed work.

| Parameters |
|---|---|
| `runnableScheduler: https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` | The `https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler` to be used |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setScheduleEventListener

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

```
@ExperimentalEventsApi
fun setScheduleEventListener(listener: ScheduleEventListener): Configuration.Builder
```

Set a `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` to run whenever work scheduling events occur for any worker.

These callbacks will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` | `https://developer.android.com/reference/kotlin/androidx/work/ScheduleEventListener` to set |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setSchedulingExceptionHandler

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

```
fun setSchedulingExceptionHandler(
    schedulingExceptionHandler: Consumer<Throwable>
): Configuration.Builder
```

Specifies a `Consumer<Throwable>` that can be used to intercept exceptions caused when trying to schedule `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`s.

It allows the application to handle a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` throwable typically caused when trying to schedule `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`s.

This exception handler will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `schedulingExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>` | an instance to handle exceptions |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setTaskExecutor

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

```
fun setTaskExecutor(taskExecutor: Executor): Configuration.Builder
```

Specifies a `https://developer.android.com/reference/java/util/concurrent/Executor.html` which will be used by WorkManager for all its internal book-keeping.

For best performance this `https://developer.android.com/reference/java/util/concurrent/Executor.html` should be bounded.

For more information look at androidx.room.RoomDatabase.Builder.setQueryExecutor.

| Parameters |
|---|---|
| `taskExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | The `https://developer.android.com/reference/java/util/concurrent/Executor.html` which will be used by WorkManager for all its internal book-keeping |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setWorkerCoroutineContext

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

```
fun setWorkerCoroutineContext(context: CoroutineContext): Configuration.Builder
```

Specifies a custom `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` to run `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker#doWork()`. WorkManager will use its own `Job` with the provided `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html`.

If `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setExecutor(java.util.concurrent.Executor)` wasn't called then `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder#setWorkerCoroutineContext(kotlin.coroutines.CoroutineContext)` will be used as `https://developer.android.com/reference/java/util/concurrent/Executor.html` to run `https://developer.android.com/reference/kotlin/androidx/work/Worker` as well.

| Parameters |
|---|---|
| `context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | A `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` for running `https://developer.android.com/reference/kotlin/androidx/work/CoroutineWorker`s |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setWorkerExecutionExceptionHandler

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

```
fun setWorkerExecutionExceptionHandler(
    workerExceptionHandler: Consumer<WorkerExceptionInfo>
): Configuration.Builder
```

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

This exception handler will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `workerExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo>` | an instance to handle exceptions |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setWorkerFactory

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

```
fun setWorkerFactory(workerFactory: WorkerFactory): Configuration.Builder
```

Specifies a custom `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` for WorkManager.

| Parameters |
|---|---|
| `workerFactory: https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` | A `https://developer.android.com/reference/kotlin/androidx/work/WorkerFactory` for creating `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`s |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |

### setWorkerInitializationExceptionHandler

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

```
fun setWorkerInitializationExceptionHandler(
    workerExceptionHandler: Consumer<WorkerExceptionInfo>
): Configuration.Builder
```

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

This exception handler will be invoked on a thread bound to `https://developer.android.com/reference/kotlin/androidx/work/Configuration#taskExecutor()`.

| Parameters |
|---|---|
| `workerExceptionHandler: https://developer.android.com/reference/kotlin/androidx/core/util/Consumer<https://developer.android.com/reference/kotlin/androidx/work/WorkerExceptionInfo>` | an instance to handle exceptions |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` | This `https://developer.android.com/reference/kotlin/androidx/work/Configuration.Builder` instance |