1

We are migrating to WorkManager, the successor of android-priority-jobqueue library. How can we implement work grouping with WorkManager. We could achieve similar structure by using WorkContinuation but it required a reference to WorkRequest instead of synchronizing on the same string.

How can we implement work grouping/chaining using WorkManager?

user802421
  • 7,465
  • 5
  • 40
  • 63

2 Answers2

1

Just found out that we can achieve this by using WorkManager.beginUniqueWork() method.

user802421
  • 7,465
  • 5
  • 40
  • 63
1

You can follow this sample provided by Google. It contains a chain of image processing. All related Worker is working under ImageOperations.java as a chain of work.

https://github.com/googlesamples/android-architecture-components/blob/master/WorkManagerSample/app/src/main/java/com/example/background/ImageOperations.kt

Gauthier
  • 4,798
  • 5
  • 34
  • 44
Tri Ngo Minh
  • 145
  • 1
  • 9