# WorkInfo.State

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

*** ** * ** ***


```
public enum WorkInfo.State extends Enum<@NonNull WorkInfo.State>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [kotlin.Enum](https://developer.android.com/reference/java/lang/Enum.html)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [WorkInfo.State](https://developer.android.com/reference/androidx/work/WorkInfo.State)\> ||
|   | ↳ | [androidx.work.WorkInfo.State](https://developer.android.com/reference/androidx/work/WorkInfo.State) |

*** ** * ** ***

The current lifecycle state of a `https://developer.android.com/reference/androidx/work/WorkRequest`.

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#BLOCKED` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is currently blocked because its prerequisites haven't finished successfully. |
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#CANCELLED` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has been cancelled and will not execute. |
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#ENQUEUED` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is enqueued and eligible to run when its `https://developer.android.com/reference/androidx/work/Constraints` are met and resources are available. |
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#FAILED` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has completed in a failure state. |
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#RUNNING` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is currently being executed. |
| `https://developer.android.com/reference/androidx/work/WorkInfo.State#SUCCEEDED` | Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has completed in a successful state. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/work/WorkInfo.State>` | `https://developer.android.com/reference/androidx/work/WorkInfo.State#getEntries()()` Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared. |
| `final boolean` | `https://developer.android.com/reference/androidx/work/WorkInfo.State#isFinished()()` Returns `true` if this State is considered finished: .SUCCEEDED, .FAILED, and \* .CANCELLED |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/work/WorkInfo.State` | `https://developer.android.com/reference/androidx/work/WorkInfo.State#valueOf(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Returns the enum constant of this type with the specified name. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull WorkInfo.State[]` | `https://developer.android.com/reference/androidx/work/WorkInfo.State#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### BLOCKED

```
WorkInfo.State WorkInfo.State.BLOCKED
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is currently blocked because its prerequisites haven't finished successfully.

### CANCELLED

```
WorkInfo.State WorkInfo.State.CANCELLED
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has been cancelled and will not execute. All dependent work will also be marked as `#CANCELLED` and will not run.

### ENQUEUED

```
WorkInfo.State WorkInfo.State.ENQUEUED
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is enqueued and eligible to run when its `https://developer.android.com/reference/androidx/work/Constraints` are met and resources are available.

### FAILED

```
WorkInfo.State WorkInfo.State.FAILED
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has completed in a failure state. All dependent work will also be marked as `#FAILED` and will never run.

### RUNNING

```
WorkInfo.State WorkInfo.State.RUNNING
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` is currently being executed.

### SUCCEEDED

```
WorkInfo.State WorkInfo.State.SUCCEEDED
```

Used to indicate that the `https://developer.android.com/reference/androidx/work/WorkRequest` has completed in a successful state. Note that `https://developer.android.com/reference/androidx/work/PeriodicWorkRequest`s will never enter this state (they will simply go back to .ENQUEUED and be eligible to run again).

## Public methods

### getEntries

```
public final @NonNull EnumEntries<@NonNull WorkInfo.State> getEntries()
```

Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared.

### isFinished

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

```
public final boolean isFinished()
```

Returns `true` if this State is considered finished: .SUCCEEDED, .FAILED, and \* .CANCELLED

### valueOf

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

```
public static final @NonNull WorkInfo.State valueOf(@NonNull String value)
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this enum type has no constant with the specified name |

### values

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

```
public static final @NonNull WorkInfo.State[] values()
```

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using `entries` property as a more efficient alternative returning an immutable list of enum entries.