WorkInfo.State


public enum WorkInfo.State extends Enum


The current lifecycle state of a WorkRequest.

Summary

Enum Values

BLOCKED

Used to indicate that the WorkRequest is currently blocked because its prerequisites haven't finished successfully.

CANCELLED

Used to indicate that the WorkRequest has been cancelled and will not execute.

ENQUEUED

Used to indicate that the WorkRequest is enqueued and eligible to run when its Constraints are met and resources are available.

FAILED

Used to indicate that the WorkRequest has completed in a failure state.

RUNNING

Used to indicate that the WorkRequest is currently being executed.

SUCCEEDED

Used to indicate that the WorkRequest has completed in a successful state.

Public methods

final @NonNull EnumEntries<@NonNull WorkInfo.State>

The current lifecycle state of a WorkRequest.

final boolean

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

final @NonNull WorkInfo.State

Returns the enum constant of this type with the specified name.

final @NonNull WorkInfo.State[]

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 WorkRequest is currently blocked because its prerequisites haven't finished successfully.

CANCELLED

WorkInfo.State WorkInfo.State.CANCELLED

Used to indicate that the 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 WorkRequest is enqueued and eligible to run when its Constraints are met and resources are available.

FAILED

WorkInfo.State WorkInfo.State.FAILED

Used to indicate that the 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 WorkRequest is currently being executed.

SUCCEEDED

WorkInfo.State WorkInfo.State.SUCCEEDED

Used to indicate that the WorkRequest has completed in a successful state. Note that PeriodicWorkRequests 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.StategetEntries()

The current lifecycle state of a WorkRequest.

isFinished

Added in 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
public 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
kotlin.IllegalArgumentException

if this enum type has no constant with the specified name

values

Added in 1.0.0
public 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.