I am developing an application where certain tasks as to be done in background at a specific time.
Android developer docs suggests various methods. I know AlarmManager can be used for this purpose. But, I think, using AlarmManager in Android 6.0 in Doze mode will give improper triggers.
I came across JobScheduling libraries from developer docs
As my application supports version below Android 5.0. I thought of using FireBaseJobDispatcher.
Can I use FirebaseJobDispatcher for trigger a specific task at a specific time.
For Example : I want to update the DB once every hour from 9AM to 6PM
You can, but if you time window is not so strict, there is no guarantee that your task start to work in a few hours later, because Doze mode. If you want really strict scheduling - use AlarmManager.setAndAllowWhileIdle. And, as I know FirebaseJobDispatcher has not released yet, and there is a few unresolved issues. Before it releases, you can use GCMNetworkManager (from Google Play Services
com.google.android.gms:play-services-gcm
) for this purpose. Your code for FirebaseJobDispatcher may looks like this:For GcmNetworkManager: