Last active
July 4, 2019 18:16
-
-
Save magdamiu/6b3ab19efe93c9591ae6d07d1545de23 to your computer and use it in GitHub Desktop.
Defining the type of the Worker
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
val syncOnlyOnce = OneTimeWorkRequestBuilder<SyncWorker>().build() | |
val syncPeriodically = PeriodicWorkRequestBuilder<SyncWorker>(1, TimeUnit.HOURS).build() | |
val periodicRefreshRequest = PeriodicWorkRequest.Builder( | |
SyncWorker::class.java, // the worker class | |
30, // repeating interval | |
TimeUnit.Minutes, | |
15, // flex interval - worker will run somehow within this period of time, but at the end of repeating interval | |
TimeUnit.MINUTES | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment