Last active
September 4, 2019 16:56
-
-
Save aggarwalpulkit596/d84760ecf5df4c2ba4c203b68c9bac31 to your computer and use it in GitHub Desktop.
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
fun updateProgress(contentId: String) { | |
val constraints = Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build() | |
val progressData = workDataOf(CONTENT_ID to contentId, RUN_ATTEMPT_ID to attemptId) | |
val request: OneTimeWorkRequest = | |
OneTimeWorkRequestBuilder<ProgressWorker>() | |
.setConstraints(constraints) | |
.setInputData(progressData) | |
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 20, TimeUnit.SECONDS) | |
.build() | |
WorkManager.getInstance() | |
.enqueue(request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment