Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use FirebaseJobDispatcher

I am trying to use FirebaseJobDispatcher by following this

But My question is that, How to set time interval for the dispatcher object like GCMNetworkManager (setPeriod). Or please explain how FirebaseJobDispatcher works.

like image 391
Vrushali Sabnis Avatar asked Jul 13 '16 04:07

Vrushali Sabnis


1 Answers

Only started working with the Dispatcher a day ago so I could be wrong. I think for what you want to do, you have to set your job as recurring and choose a fitting trigger.

final Job.Builder builder = dispatcher.newJobBuilder()
                .setTag("myJob")
                .setService(myJobService.class)
                .setRecurring(true)
                .setTrigger(Trigger.executionWindow(59, 61));

Would give you a job which repeats roughly every minute.

How to start the job and set up the Dispatcher in general I would recommend you to have a look at the testapp which is available at the FirebaseJobDispatcher git repository (which you already linked). Especially the classes JobFormActivity and DemoJobService.

like image 96
Henning Avatar answered Nov 09 '22 16:11

Henning