Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Created December 26, 2019 20:49
Show Gist options
  • Save Lavanyagaur22/17f7f6133c745993deb7ca03dda0644c to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/17f7f6133c745993deb7ca03dda0644c to your computer and use it in GitHub Desktop.
private fun scheduleTask() {
// build an object of OneTimeWorkRequestBuilder
val workerRequest = OneTimeWorkRequestBuilder<NotificationRequestWorker>()
.setInitialDelay(20, TimeUnit.SECONDS)
.build()
// Enqueue the above workrequest object to the WorkManager
WorkManager.getInstance(this).enqueue(workerRequest)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment