The second Android 11 Developer Preview is now available, test it out and share your feedback.

ExistingWorkPolicy

class ExistingWorkPolicy
kotlin.Any
   ↳ kotlin.Enum<androidx.work.ExistingWorkPolicy>
   ↳ androidx.work.ExistingWorkPolicy

An enumeration of the conflict resolution policies available to unique OneTimeWorkRequests in case of a collision.

Summary

Enum values

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.

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.

If there is existing pending (uncompleted) work with the same unique name, do nothing.

If there is existing pending (uncompleted) work with the same unique name, cancel and delete it.

Enum values

APPEND

enum val APPEND : ExistingWorkPolicy

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 to create a new chain of work.

APPEND_OR_REPLACE

enum val APPEND_OR_REPLACE : ExistingWorkPolicy

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

enum val KEEP : ExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, do nothing. Otherwise, insert the newly-specified work.

REPLACE

enum val REPLACE : ExistingWorkPolicy

If there is existing pending (uncompleted) work with the same unique name, cancel and delete it. Then, insert the newly-specified work.