falsetto
falsetto

Reputation: 789

Android Workers thread

I'm using WorkManager in my application, is there any chance to force using same thread on each Worker instance? I'm doing operations from those Worker on my list and I need to be sure that they will be in a proper order. I know that there is ExistingWorkPolicy.REPLACE but it is working only when Worker is pending not already started.

Upvotes: 0

Views: 66

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006704

I'm doing operations from those Worker on my list and I need to be sure that they will be in a proper order

WorkManager does not guarantee the order in which work gets done. Either:

  • There should be only one piece of work that does everything (so the "proper order" is simply your own logic in doWork()), or

  • You need to change your application logic such that the work can be performed in any order

Upvotes: 1

Related Questions