Krishna
Krishna

Reputation: 143

Which worker need to be use when migrating firebase-job-dispatcher to workmanager?

To use WorkManager you have to subclass one of the available Worker classes:

I want to run the job every 2 hours. Some of the answers mentioned should be use Listenable Worker. I am confusing this which one suits to this scenario. Please help me on this.

Upvotes: 0

Views: 403

Answers (1)

pfmaggi
pfmaggi

Reputation: 6476

WorkManager has some extensive documentation on how to use it that also includes a migration guide covering the move from Firebase JobDispatcher.

In the documentation you can find a section that explain the different threading behaviour of the different Worker classes.

In your particular case, it really depends if what you want to execute periodically is synchronous or not.

  • If what you want to run is synchronous: use a Worker
  • If what you want to run asynchround: use a CoroutineWorker if you're using Kotlin, otherwise you've to use a ListenableWorker.

Upvotes: 1

Related Questions