ExistingWorkPolicy
public
final
enum
ExistingWorkPolicy
extends Enum<ExistingWorkPolicy>
java.lang.Object | ||
↳ | java.lang.Enum<androidx.work.ExistingWorkPolicy> | |
↳ | androidx.work.ExistingWorkPolicy |
An enumeration of the conflict resolution policies available to unique
OneTimeWorkRequest
s in case of a collision.
Summary
Enum values | |
---|---|
ExistingWorkPolicy |
APPEND
If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as a child of all the leaves of that work sequence. |
ExistingWorkPolicy |
APPEND_OR_REPLACE
If there is existing pending (uncompleted) work with the same unique name, append the newly-specified work as the child of all the leaves of that work sequence. |
ExistingWorkPolicy |
KEEP
If there is existing pending (uncompleted) work with the same unique name, do nothing. |
ExistingWorkPolicy |
REPLACE
If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. |
Public methods | |
---|---|
static
ExistingWorkPolicy
|
valueOf(String name)
|
static
final
ExistingWorkPolicy[]
|
values()
|
Inherited methods | |
---|---|
Enum values
APPEND
public static final ExistingWorkPolicy APPEND
If there is existing pending (uncompleted) work with the same unique name, append the
newly-specified work as a child of all the leaves of that work sequence. Otherwise, insert
the newly-specified work as the start of a new sequence.
Note: When using APPEND with failed or cancelled prerequisites, newly enqueued work
will also be marked as failed or cancelled respectively. Use
APPEND_OR_REPLACE
to create a new chain of work.
APPEND_OR_REPLACE
public static final ExistingWorkPolicy APPEND_OR_REPLACE
If there is existing pending (uncompleted) work with the same unique name, append the
newly-specified work as the child of all the leaves of that work sequence. Otherwise, insert
the newly-specified work as the start of a new sequence.
Note: If there are failed or cancelled prerequisites, these prerequisites are
dropped and the newly-specified work is the start of a new sequence.
KEEP
public static final ExistingWorkPolicy KEEP
If there is existing pending (uncompleted) work with the same unique name, do nothing. Otherwise, insert the newly-specified work.
REPLACE
public static final ExistingWorkPolicy REPLACE
If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. Then, insert the newly-specified work.
Public methods
valueOf
public static ExistingWorkPolicy valueOf (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
ExistingWorkPolicy |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-02-24 UTC.