# 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 />

```
public final class WorkManagerScheduler.SchedulerWorker extends Worker
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.work.ListenableWorker](https://developer.android.com/reference/androidx/work/ListenableWorker) |||
|   | ↳ | [androidx.work.Worker](https://developer.android.com/reference/androidx/work/Worker) ||
|   |   | ↳ | [androidx.media3.exoplayer.workmanager.WorkManagerScheduler.SchedulerWorker](https://developer.android.com/reference/androidx/media3/exoplayer/workmanager/WorkManagerScheduler.SchedulerWorker) |

*** ** * ** ***

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

## Summary

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

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

### Inherited methods

From [androidx.work.ListenableWorker](https://developer.android.com/reference/androidx/work/ListenableWorker) `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/androidx/work/ListenableWorker#getApplicationContext()()`

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

Return an instance of `https://developer.android.com/reference/androidx/work/ForegroundInfo` if the `https://developer.android.com/reference/androidx/work/WorkRequest` is important to the user.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/UUID.html` `https://developer.android.com/reference/androidx/work/ListenableWorker#getId()()`

Gets the ID of the `https://developer.android.com/reference/androidx/work/WorkRequest` that created this Worker.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/work/Data` `https://developer.android.com/reference/androidx/work/ListenableWorker#getInputData()()`

Gets the input data.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/net/Network.html` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28)
https://developer.android.com/reference/androidx/work/ListenableWorker#getNetwork()()`

Gets the `https://developer.android.com/reference/android/net/Network.html` to use for this Worker.
`final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` `https://developer.android.com/reference/androidx/work/ListenableWorker#getRunAttemptCount()()`

Gets the current run attempt count for this work.
`final int` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/androidx/work/ListenableWorker#getStopReason()()`

Returns a reason why this worker has been stopped.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html>` `https://developer.android.com/reference/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/androidx/work/WorkRequest`.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 24)
https://developer.android.com/reference/androidx/work/ListenableWorker#getTriggeredContentAuthorities()()`

Gets the list of content authorities that caused this Worker to execute.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html>` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 24)
https://developer.android.com/reference/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.
`final boolean` `https://developer.android.com/reference/androidx/work/ListenableWorker#isStopped()()`

Returns `true` if this Worker has been told to stop.
`void` `https://developer.android.com/reference/androidx/work/ListenableWorker#onStopped()()`

This method is invoked when this Worker has been told to stop.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html 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/androidx/work/ListenableWorker#setForegroundAsync(androidx.work.ForegroundInfo)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/work/ForegroundInfo foregroundInfo)`

This specifies that the `https://developer.android.com/reference/androidx/work/WorkRequest` is long-running or otherwise important.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html 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/androidx/work/ListenableWorker#setProgressAsync(androidx.work.Data)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/work/Data data)`

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

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

An instance of `https://developer.android.com/reference/androidx/work/ForegroundInfo` if the `https://developer.android.com/reference/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/androidx/work/ForegroundInfo>` `https://developer.android.com/reference/androidx/work/Worker#getForegroundInfoAsync()()`

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

Override this method to start your actual background processing.

## Public constructors

### SchedulerWorker

```
public SchedulerWorker(Context context, WorkerParameters workerParams)
```

## Public methods

### doWork

```
public ListenableWorker.Result doWork()
```

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/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/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/androidx/work/ListenableWorker.Result`. After this time has expired, the Worker will be signalled to stop.

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