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.
How do these two libraries compare? What are their strength and weaknesses?
There's a nice table of comparison in Firebase JobDispatcher github page:
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).