Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

Configuration.Builder

public static final class Configuration.Builder
extends Object

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


A Builder for Configuration.

Summary

Public constructors

Configuration.Builder()

Public methods

Configuration build()

Builds a Configuration object.

Configuration.Builder setExecutor(Executor executor)

Specifies a custom Executor 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 withExecutor(Executor executor)

This method is deprecated. Use the setExecutor(Executor) method instead

Inherited methods

Public constructors

Configuration.Builder

public Configuration.Builder ()

Public methods

build

public Configuration build ()

Builds a Configuration object.

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

setExecutor

public Configuration.Builder setExecutor (Executor executor)

Specifies a custom Executor for WorkManager.

Parameters
executor Executor: An Executor for processing work

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.

Parameters
minJobSchedulerId int: The first valid JobInfo ID inclusive.

maxJobSchedulerId int: The last valid JobInfo ID inclusive.

Returns
Configuration.Builder This Configuration.Builder instance

Throws
IllegalArgumentException when the size of the range is < 1000

setMaxSchedulerLimit

public Configuration.Builder setMaxSchedulerLimit (int maxSchedulerLimit)

Specifies the maximum number of system requests made by WorkManager when using JobScheduler or AlarmManager. When the application exceeds this limit WorkManager maintains an internal queue of WorkRequests, and enqueues when slots become free. WorkManager requires a minimum of Configuration.MIN_SCHEDULER_LIMIT slots. The total number of slots also cannot exceed 100 which is the JobScheduler limit.

Parameters
maxSchedulerLimit int: The total number of jobs which can be enqueued by WorkManager when using JobScheduler.

Returns
Configuration.Builder This Configuration.Builder instance

Throws
IllegalArgumentException when the number of jobs < Configuration.MIN_SCHEDULER_LIMIT

withExecutor

public Configuration.Builder withExecutor (Executor executor)

This method is deprecated.
Use the setExecutor(Executor) method instead

Specifies a custom Executor for WorkManager.

Parameters
executor Executor: An Executor for processing work

Returns
Configuration.Builder This Configuration.Builder instance