10

Currently, in Android, to do a task periodically based on time or any other factors like charging state, network state etc, the basic three options are: Android AlarmManager (which works periodically based on time), GCMTaskService (requires Google Play Service on device) and JobScheduler (requires Android Version > 21). Recently, I've come across these two libraries for scheduling jobs, one from Firebase and one from Evernote.

My primary question is: How do these two libraries compare? What are their strength and weaknesses?

I want to build an app where a user is reminded of taking medicines periodically after certain time period.

My secondary question is: would simple AlarmManager suffice for this purpose, or should I go for any of these two libraries?

Thanks.

azizbekian
  • 60,783
  • 13
  • 169
  • 249
Riddhiman Adib
  • 388
  • 1
  • 14

1 Answers1

8

How do these two libraries compare? What are their strength and weaknesses?

There's a nice table of comparison in Firebase JobDispatcher github page:

enter image description here

The key difference is Google Play services presence: Firebase needs device to have it installed, whereas Evernote is Play Services independent.

I want to build an app where a user is reminded of taking medicines periodically after certain time period. Would simple AlarmManager suffice for this purpose, or should I go for any of these two libraries?

The rule of thumb is, that most possibly you won't need AlarmManager, because it is a battery drainer. One of key features of job dispatchers is that they combine jobs and execute them in a single window, thus device won't wake up too often.

You'd better stick with job dispatchers, unless taking medicines should have exact timing like alarm (e.g. you want to notify user to take the medicine exactly in 3 hours).

azizbekian
  • 60,783
  • 13
  • 169
  • 249
  • 1
    One information I noticed. I've used alarm manager for notification intent. That was working below and above lollipop devices. ```But lollipop devices messed up alarm notification timing. Can i use theses android job scheduler for my purposes?``` – Mahmudul Apr 04 '17 at 06:57
  • 2
    @Mahmudul, if it is acceptable for you to **not** be exact in time - you are free to go with job scheduler approach. If you need exactness - you have to stick to `AlarManager`. – azizbekian Apr 04 '17 at 07:32
  • @Mahmudul , go with Firebase JobDispatcher. – Sanidhya Kumar Jun 02 '17 at 10:03