user802421
user802421

Reputation: 7505

Work grouping/chaining for WorkManager similar to android-priority-jobqueue

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?

Upvotes: 1

Views: 1134

Answers (2)

Tri Ngo Minh
Tri Ngo Minh

Reputation: 155

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

Upvotes: 1

user802421
user802421

Reputation: 7505

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

Upvotes: 1

Related Questions