Configuration

public final class Configuration
extends Object

java.lang.Object
   ↳ androidx.work.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(Context, Configuration).

Summary

Nested classes

class Configuration.Builder

A Builder for Configurations. 

interface Configuration.Provider

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

Constants

int MIN_SCHEDULER_LIMIT

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

Public methods

Executor getExecutor()

Gets the Executor used by WorkManager to execute Workers.

int getMaxJobSchedulerId()

Gets the last valid id when scheduling work with JobScheduler.

int getMinJobSchedulerId()

Gets the first valid id used when scheduling work with JobScheduler.

Executor getTaskExecutor()

Gets the Executor used by WorkManager for all its internal business logic.

WorkerFactory getWorkerFactory()

Gets the WorkerFactory used by WorkManager to create ListenableWorkers.

Inherited methods

Constants

MIN_SCHEDULER_LIMIT

public static final int MIN_SCHEDULER_LIMIT

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

Constant Value: 20 (0x00000014)

Public methods

getExecutor

public Executor getExecutor ()

Gets the Executor used by WorkManager to execute Workers.

Returns
Executor The Executor used by WorkManager to execute Workers

getMaxJobSchedulerId

public int getMaxJobSchedulerId ()

Gets the last valid id when scheduling work with JobScheduler.

Returns
int The last valid id (inclusive) used by WorkManager when creating new instances of JobInfos. If the current jobId goes beyond the bounds of the defined range of (getMinJobSchedulerId(), getMaxJobSchedulerId()), it is reset to (getMinJobSchedulerId()).

getMinJobSchedulerId

public int getMinJobSchedulerId ()

Gets the first valid id used when scheduling work with JobScheduler.

Returns
int The first valid id (inclusive) used by WorkManager when creating new instances of JobInfos. If the current jobId goes beyond the bounds of the defined range of (getMinJobSchedulerId(), getMaxJobSchedulerId()), it is reset to (getMinJobSchedulerId()).

getTaskExecutor

public Executor getTaskExecutor ()

Gets the Executor used by WorkManager for all its internal business logic.

Returns
Executor The Executor used by WorkManager for all its internal business logic

getWorkerFactory

public WorkerFactory getWorkerFactory ()

Gets the WorkerFactory used by WorkManager to create ListenableWorkers.

Returns
WorkerFactory The WorkerFactory used by WorkManager to create ListenableWorkers