FireBase Work Manager. work starts in 20-60 seconds, even with Triger.Now. How can i fix this?

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 the conditions are here, my work begins with a delay. Can I call him somehow?

+6
source share
1 answer

Use Trigger.executionWindow(0, 0)instead Trigger.NOW. Usually it starts your work immediately or within 1 second.

+4
source

Source: https://habr.com/ru/post/1014311/


All Articles