DelegatingWorker

class DelegatingWorker(appContext: Context, workerParams: WorkerParameters) : CoroutineWorker

A worker that delegates sync to another CoroutineWorker constructed with a HiltWorkerFactory.

This allows for creating and using CoroutineWorker instances with extended arguments without having to provide a custom WorkManager configuration that the app module needs to utilize.

In other words, it allows for custom workers in a library module without having to own configuration of the WorkManager singleton.

Constructors

Link copied to clipboard
constructor(appContext: Context, workerParams: WorkerParameters)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val coroutineContext: CoroutineDispatcher
Link copied to clipboard
val foregroundInfoAsync: com/google/common/util/concurrent/ListenableFuture<androidx/work/ForegroundInfo>
Link copied to clipboard
val id: @NonNull UUID
Link copied to clipboard
val inputData: @NonNull Data
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@get:RequiresApi(value = 28)
val network: @Nullable Network?
Link copied to clipboard
@get:IntRange(from = 0)
val runAttemptCount: Int
Link copied to clipboard
@get:RequiresApi(value = 31)
val stopReason: Int
Link copied to clipboard
val tags: @NonNull Set<String?>
Link copied to clipboard
open val taskExecutor: @NonNull TaskExecutor
Link copied to clipboard
@get:RequiresApi(value = 24)
val triggeredContentAuthorities: @NonNull List<String?>
Link copied to clipboard
@get:RequiresApi(value = 24)
val triggeredContentUris: @NonNull List<Uri?>
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun doWork(): ListenableWorker.Result

Delegates the work to the delegate worker

Link copied to clipboard
open suspend override fun getForegroundInfo(): ForegroundInfo

Retrieves the foreground info from the delegate worker

Link copied to clipboard
override fun getForegroundInfoAsync(): com/google/common/util/concurrent/ListenableFuture<androidx/work/ForegroundInfo>
Link copied to clipboard
override fun onStopped()
Link copied to clipboard
suspend fun setForeground(foregroundInfo: ForegroundInfo)
Link copied to clipboard
fun setForegroundAsync(foregroundInfo: @NonNull ForegroundInfo): @EnhancedNullability @R|org/jspecify/annotations/NonNull|() com/google/common/util/concurrent/ListenableFuture
Link copied to clipboard
suspend fun setProgress(data: Data)
Link copied to clipboard
open fun setProgressAsync(data: @NonNull Data): @EnhancedNullability @R|org/jspecify/annotations/NonNull|() com/google/common/util/concurrent/ListenableFuture
Link copied to clipboard
Link copied to clipboard
override fun startWork(): com/google/common/util/concurrent/ListenableFuture<androidx/work/ListenableWorker.Result>
Link copied to clipboard