Created
September 15, 2019 16:29
-
-
Save magdamiu/bdf3165ba7e9230a9b462b7b6eea7c15 to your computer and use it in GitHub Desktop.
BackoffPolicy example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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