CoroutineWorker
Kotlin
|Java
abstract class CoroutineWorker : ListenableWorker
kotlin.Any | ||
↳ | androidx.work.ListenableWorker | |
↳ | androidx.work.CoroutineWorker |
A ListenableWorker implementation that provides interop with Kotlin Coroutines. Override the doWork function to do your suspending work.
Summary
Public constructors | |
---|---|
<init>(appContext: Context, params: WorkerParameters) A ListenableWorker implementation that provides interop with Kotlin Coroutines. |
Public methods | |
---|---|
abstract suspend ListenableWorker.Result |
doWork() A suspending method to do your work. |
open suspend ForegroundInfo | |
ListenableFuture<ForegroundInfo> | |
Unit | |
suspend Unit |
setForeground(foregroundInfo: ForegroundInfo) Makes the CoroutineWorker run in the context of a foreground android.app.Service. |
suspend Unit |
setProgress(data: Data) Updates the progress for the CoroutineWorker. |
ListenableFuture<ListenableWorker.Result> |
Inherited functions | |
---|---|
Properties | |
---|---|
open CoroutineDispatcher |
The coroutine context on which doWork will run. |
Public constructors
<init>
CoroutineWorker(
appContext: Context,
params: WorkerParameters)
A ListenableWorker implementation that provides interop w