# WorkerParameters

Artifact: [androidx.work:work-runtime](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/WorkerParameters.java+class:androidx.work.WorkerParameters) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

*** ** * ** ***


```
class WorkerParameters
```

<br />

*** ** * ** ***

Setup parameters for a `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`.

## Summary

| ### Public functions |
|---|---|
| `@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/WorkerParameters#getGeneration()()` Gets the generation of this Worker. |
| `https://developer.android.com/reference/java/util/UUID.html` | `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters#getId()()` Gets the ID of the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that created this `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`. |
| `https://developer.android.com/reference/kotlin/androidx/work/Data` | `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters#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/WorkerParameters#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/WorkerParameters#getRunAttemptCount()()` Gets the current run attempt count for this work. |
| `(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/WorkerParameters#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/WorkerParameters#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/WorkerParameters#getTriggeredContentUris()()` Gets the list of content `https://developer.android.com/reference/android/net/Uri.html`s that caused this Worker to execute. |

| ### Extension functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters.https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters#(androidx.work.WorkerParameters).isRemoteWorkRequest()()` |
| `inline https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` | `<T : https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker> https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters.https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters#(androidx.work.WorkerParameters).usingRemoteService(android.content.ComponentName)( componentName: https://developer.android.com/reference/android/content/ComponentName.html )` Returns a new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` representing a `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that can run in a process corresponding to the provided `https://developer.android.com/reference/android/content/ComponentName.html`. |
| `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` | `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters.https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters#(androidx.work.WorkerParameters).usingRemoteService(kotlin.String,android.content.ComponentName)( workerClassName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, componentName: https://developer.android.com/reference/android/content/ComponentName.html )` Returns a new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` representing a `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that can run in a process corresponding to the provided `https://developer.android.com/reference/android/content/ComponentName.html`. |

## Public functions

### getGeneration

Added in [2.8.0](https://developer.android.com/jetpack/androidx/releases/work#2.8.0)

```
fun getGeneration(): @IntRange(from = 0) Int
```

Gets the generation of this Worker.

A work has multiple generations, if it was updated via `https://developer.android.com/reference/kotlin/androidx/work/WorkManager#updateWork(androidx.work.WorkRequest)` or `https://developer.android.com/reference/kotlin/androidx/work/WorkManager#enqueueUniquePeriodicWork(java.lang.String,androidx.work.ExistingPeriodicWorkPolicy,androidx.work.PeriodicWorkRequest)` using `https://developer.android.com/reference/kotlin/androidx/work/ExistingPeriodicWorkPolicy#UPDATE`. This worker can possibly be of an older generation rather than latest known, if an update has happened while this worker is running.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a generation of this work. |

### getId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
fun getId(): UUID
```

Gets the ID of the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that created this `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/UUID.html` | The ID of the creating `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` |

### getInputData

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
fun getInputData(): Data
```

Gets the input data. Note that in the case that there are multiple prerequisites for this `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker`, the input data has been run through an `https://developer.android.com/reference/kotlin/androidx/work/InputMerger`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Data` | The input data for this work |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/OneTimeWorkRequest.Builder#setInputMerger(java.lang.Class<? extends androidx.work.InputMerger>)` |   |

### getNetwork

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
@RequiresApi(value = 28)
fun getNetwork(): Network?
```

Gets the `https://developer.android.com/reference/android/net/Network.html` to use for this Worker. This method returns `null` if there is no network needed for this work request.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/net/Network.html?` | The `https://developer.android.com/reference/android/net/Network.html` specified by the OS to be used with this Worker |

### getRunAttemptCount

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
fun getRunAttemptCount(): @IntRange(from = 0) Int
```

Gets the current run attempt count for this work. Note that for periodic work, this value gets reset between periods.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The current run attempt count for this work. |

### getTags

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
fun getTags(): (Mutable)Set<String!>
```

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`.

| Returns |
|---|---|
| `(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!>` | The `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` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest.Builder#addTag(java.lang.String)` |   |

### getTriggeredContentAuthorities

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
@RequiresApi(value = 24)
fun getTriggeredContentAuthorities(): (Mutable)List<String!>
```

Gets the list of content authorities that caused this Worker to execute. See `JobParameters#getTriggeredContentAuthorities()` for relevant `JobScheduler` code.

| Returns |
|---|---|
| `(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!>` | The list of content authorities that caused this Worker to execute |

### getTriggeredContentUris

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/work#1.0.0)

```
@RequiresApi(value = 24)
fun getTriggeredContentUris(): (Mutable)List<Uri!>
```

Gets the list of content `https://developer.android.com/reference/android/net/Uri.html`s that caused this Worker to execute. See

JobParameters#getTriggeredContentUris()} for relevant `JobScheduler` code.

| Returns |
|---|---|
| `(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!>` | The list of content `https://developer.android.com/reference/android/net/Uri.html`s that caused this Worker to execute |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/Constraints.Builder#addContentUriTrigger(android.net.Uri,boolean)` |   |

## Extension functions

### WorkerParameters.isRemoteWorkRequest

Artifact: [androidx.work:work-runtime](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/WorkerParameters.kt+function:isRemoteWorkRequest)

```
fun WorkerParameters.isRemoteWorkRequest(): Boolean
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if and only if the instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` corresponds to a `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that runs in a remote process. |

### WorkerParameters.usingRemoteService

Artifact: [androidx.work:work-runtime](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/WorkerParameters.kt+function:usingRemoteService)

```
inline fun <T : ListenableWorker> WorkerParameters.usingRemoteService(
    componentName: ComponentName
): WorkerParameters
```

Returns a new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` representing a `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that can run in a process corresponding to the provided `https://developer.android.com/reference/android/content/ComponentName.html`.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker>` | The `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker` to delegate to. |
| `componentName: https://developer.android.com/reference/android/content/ComponentName.html` | The `https://developer.android.com/reference/android/content/ComponentName.html` that identifies the `RemoteService` that hosts the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` | A new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` |

### WorkerParameters.usingRemoteService

Artifact: [androidx.work:work-runtime](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/WorkerParameters.kt+function:usingRemoteService)

```
fun WorkerParameters.usingRemoteService(
    workerClassName: String,
    componentName: ComponentName
): WorkerParameters
```

Returns a new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` representing a `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest` that can run in a process corresponding to the provided `https://developer.android.com/reference/android/content/ComponentName.html`.

| Parameters |
|---|---|
| `workerClassName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The fully qualified class name of the `https://developer.android.com/reference/kotlin/androidx/work/ListenableWorker` to delegate to |
| `componentName: https://developer.android.com/reference/android/content/ComponentName.html` | The `https://developer.android.com/reference/android/content/ComponentName.html` that identifies the `RemoteService` that hosts the `https://developer.android.com/reference/kotlin/androidx/work/WorkRequest`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` | A new instance of `https://developer.android.com/reference/kotlin/androidx/work/WorkerParameters` |