Skip to content

Instantly share code, notes, and snippets.

@robertlevonyan
Created March 6, 2019 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertlevonyan/771cf97dcfca86a14d205bbc9313ea17 to your computer and use it in GitHub Desktop.
Save robertlevonyan/771cf97dcfca86a14d205bbc9313ea17 to your computer and use it in GitHub Desktop.
fun chainWorks(filter1: Work, filter2: Work, compress: Work, upload: Work) {
WorkManager.getInstance()
// Run these works in parallel
.beginWith(listOf(filter1, filter2))
// Dependent work (only runs after all previous work in chain)
.then(compress)
.then(upload)
// Don't forget to enqueue()
.enqueue()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment