Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BackoffPolicy example
// add initial delay only for OneTimeWorkRequest
val syncOnlyOnce = OneTimeWorkRequestBuilder<SyncWorker>()
.setInitialDelay(15, TimeUnit.MINUTES)
.build()
// backoff delay and policy
val syncOnlyOnce = OneTimeWorkRequestBuilder<SyncWorker>()
.setBackoffCriteria(BackoffPolicy.LINEAR,
OneTimeWorkRequest.MIN_BACKOFF_MILLIS,
TimeUnit.MICROSECONDS)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment