# WorkManagerScheduler.SchedulerWorker

Artifact: [androidx.media3:media3-exoplayer-workmanager](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/workmanager/WorkManagerScheduler.java+class:androidx.media3.exoplayer.workmanager.WorkManagerScheduler.SchedulerWorker)

*** ** * ** ***

<br />

```
class WorkManagerScheduler.SchedulerWorker : Worker
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.work.ListenableWorker](https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker) |||
|   | ↳ | [androidx.work.Worker](https://developer.android.com/reference/kotlin/androidx/work/Worker) ||
|   |   | ↳ | [androidx.media3.exoplayer.workmanager.WorkManagerScheduler.SchedulerWorker](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/workmanager/WorkManagerScheduler.SchedulerWorker) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/work/Worker` that starts the target service if the requirements are met.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/workmanager/WorkManagerScheduler.SchedulerWorker#SchedulerWorker(android.content.Context,androidx.work.WorkerParameters)(context: https://developer.android.com/reference/android/content/Context.html!, workerParams: https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters!)` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/workmanager/WorkManagerScheduler.SchedulerWorker#doWork()()` Override this method to do your actual background processing. |

### Inherited functions

From [androidx.work.ListenableWorker](https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker) `https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getApplicationContext()()`

Gets the application `https://developer.android.com/reference/android/content/Context.html`.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo!>` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getForegroundInfoAsync()()`

Return an instance of `https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo` if the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` is important to the user.
`https://developer.android.com/reference/java/util/UUID.html` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getId()()`

Gets the ID of the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that created this Worker.
`https://developer.android.com/reference/kotlin/androidx/work/Data` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getInputData()()`

Gets the input data.
`https://developer.android.com/reference/android/net/Network.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 28)
https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getNetwork()()`

Gets the `https://developer.android.com/reference/android/net/Network.html` to use for this Worker.
`@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getRunAttemptCount()()`

Gets the current run attempt count for this work.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getStopReason()()`

Returns a reason why this worker has been stopped.
`(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getTags()()`

Gets a `https://developer.android.com/reference/java/util/Set.html` of tags associated with this Worker's `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`.
`(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 24)
https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getTriggeredContentAuthorities()()`

Gets the list of content authorities that caused this Worker to execute.
`(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/net/Uri.html!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 24)
https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#getTriggeredContentUris()()`

Gets the list of content `https://developer.android.com/reference/android/net/Uri.html`s that caused this Worker to execute.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#isStopped()()`

Returns `true` if this Worker has been told to stop.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#onStopped()()`

This method is invoked when this Worker has been told to stop.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#setForegroundAsync(androidx.work.ForegroundInfo)(foregroundInfo: https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo)`

This specifies that the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` is long-running or otherwise important.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html!>` `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#setProgressAsync(androidx.work.Data)(data: https://developer.android.com/reference/kotlin/androidx/work/Data)`

Updates `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker` progress.
`abstract https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker#startWork()()`

Override this method to start your actual background processing.
From [androidx.work.Worker](https://developer.android.com/reference/kotlin/androidx/work/Worker) `https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo!` `https://developer.android.com/reference/kotlin/androidx/work/Worker#getForegroundInfo()()`

An instance of `https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo` if the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` is important to the user.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo!>!` `https://developer.android.com/reference/kotlin/androidx/work/Worker#getForegroundInfoAsync()()`

Return an instance of `https://developer.android.com/reference/kotlin/androidx/work/ForegroundInfo` if the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` is important to the user.
`https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result!>!` `https://developer.android.com/reference/kotlin/androidx/work/Worker#startWork()()`

Override this method to start your actual background processing.

## Public constructors

### SchedulerWorker

```
SchedulerWorker(context: Context!, workerParams: WorkerParameters!)
```

## Public functions

### doWork

```
fun doWork(): ListenableWorker.Result!
```

Override this method to do your actual background processing. This method is called on a background thread - you are required to **synchronously** do your work and return the `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result` from this method. Once you return from this method, the Worker is considered to have finished what its doing and will be destroyed. If you need to do your work asynchronously on a thread of your own choice, see `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`.

A Worker has a well defined [execution window](https://d.android.com/reference/android/app/job/JobScheduler) to finish its execution and return a `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result`. After this time has expired, the Worker will be signalled to stop.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result!` | The `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result` of the computation; note that dependent work will not execute if you use `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result#failure()` or `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker.Result#failure()` |