Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

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, 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.

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.