Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FireBase Job Dispatcher. job starts after 20-60 sec, even with Triger.Now. How can i fix it?

Job job = dispatcher.newJobBuilder()
            .setTag("JOB_TAG")
            .setService(MyService.class)
            .setTrigger(Trigger.NOW)
            .setReplaceCurrent(false)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .build();
    dispatcher.schedule(job);

my code is here. even when all conditions are here, my job starts with delay. Can i trigger it somehow?

like image 895
Roman Trokachevsky Avatar asked Jan 23 '17 09:01

Roman Trokachevsky


1 Answers

Use Trigger.executionWindow(0, 0) instead of Trigger.NOW .It will normally start your job immediately or within 1 second.

like image 177
Android Developer Avatar answered Nov 04 '22 18:11

Android Developer