2

The Firebase JobDispatcher makes use of a Driver interface that requires Google Play services to work:

Driver is an interface that represents a component that can schedule, cancel, and execute Jobs. The only bundled Driver is the GooglePlayDriver, which relies on the scheduler built-in to Google Play services.

Is there a handy example out there of a Driver for Firebase JobDispatcher that does not require Google Play services?

drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
  • 1
    There wasn't the last time I looked. A Google search on `jobdispatcher "implements Driver"` turns up nothing beyond `GooglePlayDriver`. – CommonsWare Sep 10 '16 at 19:38
  • OK thanks @CommonsWare. In your estimation, is creating such a `Driver` something not to be attempted by the faint-hearted? Apart from wanting to avoid a reliance on Play services where possible, another reason for investigating this is that I'm finding it frustrating that you can't seem to control (where required) the delay before a job is run (from all constraints being met) -- see my post at http://stackoverflow.com/questions/39363839/jobscheduler-controlling-delay-from-constraints-being-met-to-job-being-run -- and a custom `Driver` might possibly enable this finer control? Or maybe not. – drmrbrewer Sep 10 '16 at 19:50
  • Well, `JobDispatcher` just delegates to a driver. It's not like something named `JobDispatcher` can overcome limitations when a compatible `Driver` uses `JobScheduler` than you could on your own using `JobScheduler`. `JobDispatcher`, like Evernote's `android-job` library, is mostly there for a single API with different implementations based on API level and whether it's a Play ecosystem device or not. Now, could `JobDispatcher` using `GcmNetworkManager` from Play Services give you what you want? Possibly, at the cost of the Play Services dependency. – CommonsWare Sep 10 '16 at 20:14

1 Answers1

0

Firebase JobDispatcher relies its scheduling components on the Google Play Services, and so it isn't possible to use that on 100% of the Android devices, indeed many developers quitted using this library because it precludes the correct outcome of every device with legacy versions of Google Play or with custom roms like LineageOS that does not support this system by default.

As the firebase github repository readme says, there 2 alternatives that runs without Google Play

Table

You can see that in the table, the only libraries that uses the JobScheduler APIs are the built-in JobScheduler and the firebase JobDispatcher

However, the one that supports lower API levels and has the best success rate is android-job from evernote, in my opinion it is worth the effort to start using it instead of Firebase JobDispatcher

ci0ccarellia
  • 795
  • 9
  • 26