Configuration.Builder

public static final class Configuration.Builder
extends Object

java.lang.Object
   ↳ androidx.work.Configuration.Builder


A Builder for Configurations.

Summary

Public constructors

Builder()

Creates a new Configuration.Builder.

Public methods

Configuration build()

Builds a Configuration object.

Configuration.Builder setDefaultProcessName(String processName)

Designates the primary process that WorkManager should schedule work in.

Configuration.Builder setExecutor(Executor executor)

Specifies a custom Executor for WorkManager.

Configuration.Builder setInputMergerFactory(InputMergerFactory inputMergerFactory)

Specifies a custom InputMergerFactory for WorkManager.

Configuration.Builder setJobSchedulerJobIdRange(int minJobSchedulerId, int maxJobSchedulerId)

Specifies the range of JobInfo IDs that can be used by WorkManager.

Configuration.Builder setMaxSchedulerLimit(int maxSchedulerLimit)

Specifies the maximum number of system requests made by WorkManager when using JobScheduler or AlarmManager.

Configuration.Builder setMinimumLoggingLevel(int loggingLevel)

Specifies the minimum logging level, corresponding to the constants found in Log.

Configuration.Builder setRunnableScheduler(RunnableScheduler runnableScheduler)

Specifies the RunnableScheduler to be used by WorkManager.

Configuration.Builder setTaskExecutor(Executor taskExecutor)

Specifies a Executor which will be used by WorkManager for all its internal book-keeping.

Configuration.Builder setWorkerFactory(WorkerFactory workerFactory)

Specifies a custom WorkerFactory for WorkManager.

Inherited methods

Public constructors

Builder

public Builder ()

Creates a new Configuration.Builder.

Public methods

build

public Configuration build ()

Builds a Configuration object.

Returns
Configuration A Configuration object with this Configuration.Builder's parameters.

setDefaultProcessName

public Configuration.Builder setDefaultProcessName (String processName)

Designates the primary process that WorkManager should schedule work in.

Parameters
processName String: The String process name.

Returns
Configuration.Builder This Configuration.Builder instance

setExecutor

public Configuration.Builder setExecutor (Executor executor)

Specifies a custom Executor for WorkManager.

Parameters
executor Executor: An Executor for running Workers

Returns
Configuration.Builder This Configuration.Builder instance

setInputMergerFactory

public Configuration.Builder setInputMergerFactory (InputMergerFactory inputMergerFactory)

Specifies a custom InputMergerFactory for WorkManager.

Parameters
inputMergerFactory InputMergerFactory: A InputMergerFactory for creating InputMergers

Returns
Configuration.Builder This Configuration.Builder instance

setJobSchedulerJobIdRange

public Configuration.Builder setJobSchedulerJobIdRange (int minJobSchedulerId, 
                int maxJobSchedulerId)

Specifies the range of JobInfo IDs that can be used by 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 int: The first valid JobInfo ID (inclusive).

maxJobSchedulerId int: The last valid JobInfo ID (inclusive).

Returns
Configuration.Builder This Configuration.Builder i