Configuration
class 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.
Summary
Nested types |
|---|
class Configuration.BuilderA Builder for |
interface Configuration.ProviderA class that can provide the |
Constants |
|
|---|---|
const Int |
MIN_SCHEDULER_LIMIT = 20The minimum number of system requests which can be enqueued by |
Public functions |
|
|---|---|
Boolean |
Specifies whether WorkManager automatically set |
Public properties |
|
|---|---|
Clock |
The |
Int |
Maximum number of Workers with |
String? |
The |
Executor |
The |
Consumer<Throwable>? |
The exception handler that is used to intercept exceptions caused when trying to initialize |
InputMergerFactory |
The |
Int |
The last valid id (inclusive) used by |
Int |
The first valid id (inclusive) used by |
@IntRange(from = 0, to = 1200000) Long |
The time in milliseconds that the designated process stays active before unbinding when using |
RunnableScheduler |
The |
Consumer<Throwable>? |
The exception handler that can be used to intercept exceptions caused when trying to schedule |
Executor |
The |
CoroutineContext |
The |
Consumer<WorkerExceptionInfo>? |
The exception handler that can be used to intercept exceptions caused when trying to execute |
WorkerFactory |
The |
Consumer<WorkerExceptionInfo>? |
The exception handler that can be used to intercept exceptions caused when trying to initialize |
Constants
MIN_SCHEDULER_LIMIT
const val MIN_SCHEDULER_LIMIT = 20: Int
The minimum number of system requests which can be enqueued by WorkManager when using android.app.job.JobScheduler or android.app.AlarmManager.
Public functions
isMarkingJobsAsImportantWhileForeground
@ExperimentalConfigurationApi
fun isMarkingJobsAsImportantWhileForeground(): Boolean
Specifies whether WorkManager automatically set android.app.job.JobInfo.Builder.setImportantWhileForeground for workers that are eligible to run immediately.
Public properties
clock
val clock: Clock
The Clock used by WorkManager to calculate schedules and perform book-keeping.
contentUriTriggerWorkersLimit
val contentUriTriggerWorkersLimit: Int
Maximum number of Workers with Constraints.contentUriTriggers that could be enqueued simultaneously.
Unlike the other workers Workers with Constraints.contentUriTriggers must immediately occupy slots in JobScheduler to avoid missing updates, thus they are separated in its own category.
defaultProcessName
val defaultProcessName: String?
The String name of the process where work should be scheduled.
initializationExceptionHandler
val initializationExceptionHandler: Consumer<Throwable>?
The exception handler that is used to intercept exceptions caused when trying to initialize WorkManager.
inputMergerFactory
val inputMergerFactory: InputMergerFactory
The InputMergerFactory used by WorkManager to create instances of InputMergers.
maxJobSchedulerId
val maxJobSchedulerId: Int
The last valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.
If the current jobId goes beyond the bounds of the defined range of (Configuration.minJobSchedulerId, Configuration.maxJobSchedulerId), it is reset to (Configuration.minJobSchedulerId).
minJobSchedulerId
val minJobSchedulerId: Int
The first valid id (inclusive) used by WorkManager when creating new instances of android.app.job.JobInfos.
If the current jobId goes beyond the bounds of the defined range of (Configuration.minJobSchedulerId, Configuration.maxJobSchedulerId), it is reset to (Configuration.minJobSchedulerId).
remoteSessionTimeoutMillis
val remoteSessionTimeoutMillis: @IntRange(from = 0, to = 1200000) Long
The time in milliseconds that the designated process stays active before unbinding when using androidx.work.multiprocess.RemoteWorkManager.
The default timeout is androidx.work.multiprocess.RemoteWorkManager.DEFAULT_SESSION_TIMEOUT_MILLIS.
runnableScheduler
val runnableScheduler: RunnableScheduler
The RunnableScheduler to keep track of timed work in the in-process scheduler.
schedulingExceptionHandler
val schedulingExceptionHandler: Consumer<Throwable>?
The exception handler that can be used to intercept exceptions caused when trying to schedule WorkRequests.
taskExecutor
val taskExecutor: Executor
The Executor used by WorkManager for all its internal business logic
workerCoroutineContext
val workerCoroutineContext: CoroutineContext
The CoroutineContext used by WorkManager to execute CoroutineWorkers.
workerExecutionExceptionHandler
val workerExecutionExceptionHandler: Consumer<WorkerExceptionInfo>?
The exception handler that can be used to intercept exceptions caused when trying to execute ListenableWorkers.
workerFactory
val workerFactory: WorkerFactory
The WorkerFactory used by WorkManager to create ListenableWorkers
workerInitializationExceptionHandler
val workerInitializationExceptionHandler: Consumer<WorkerExceptionInfo>?
The exception handler that can be used to intercept exceptions caused when trying to initialize ListenableWorkers.