ExistingWorkPolicy | API reference | Android Developers (original) (raw)
public enum ExistingWorkPolicy extends Enum
An enumeration of the conflict resolution policies available to unique [OneTimeWorkRequest](/reference/androidx/work/OneTimeWorkRequest)s in case of a collision.
Summary
| Enum Values | |
|---|---|
| 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. |
| 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. |
| KEEP | If there is existing pending (uncompleted) work with the same unique name, do nothing. |
| REPLACE | If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. |
Enum Values
APPEND
ExistingWorkPolicy 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 [ExistingWorkPolicy.APPEND_OR_REPLACE](/reference/androidx/work/ExistingWorkPolicy#APPEND%5FOR%5FREPLACE) to create a new chain of work.
APPEND_OR_REPLACE
ExistingWorkPolicy 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.
Public methods
valueOf
public final @NonNull ExistingWorkPolicy 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.)
values
public final @NonNull ExistingWorkPolicy[] 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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.