Register now for Android Dev Summit 2019!

WorkInfo.State

public static final enum WorkInfo.State
extends Enum<WorkInfo.State>

java.lang.Object
   ↳ java.lang.Enum<androidx.work.WorkInfo.State>
     ↳ androidx.work.WorkInfo.State


The current lifecycle state of a WorkRequest.

Summary

Enum values

WorkInfo.State  BLOCKED

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

WorkInfo.State  CANCELLED

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

WorkInfo.State  ENQUEUED

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

WorkInfo.State  FAILED

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

WorkInfo.State  RUNNING

Used to indicate that the WorkRequest is currently being executed. 

WorkInfo.State  SUCCEEDED

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

Public methods

boolean isFinished()

Returns true if this State is considered finished.

static WorkInfo.State valueOf(String name)
static final State[] values()

Inherited methods

Enum values

BLOCKED

public static final WorkInfo.State BLOCKED

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

CANCELLED

public static final 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

public static final 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

public static final 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

public static final WorkInfo.State RUNNING

Used to indicate that the WorkRequest is currently being executed.

SUCCEEDED

public static final 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

isFinished

public boolean isFinished ()

Returns true if this State is considered finished.

Returns
boolean true for SUCCEEDED, FAILED, and * CANCELLED states

valueOf

public static WorkInfo.State valueOf (String name)

Parameters
name String

Returns
WorkInfo.State

values

public static final State[] values ()

Returns
State[]