0

I'm using firebase job dispatcher for making network calls lets say every 30 seconds, my service class:

 @Override
public boolean onStartJob(JobParameters job) {
    getLocation();
    return true;
}

and my job instance:

 Job job = dispatcher.newJobBuilder()
            .setLifetime(Lifetime.FOREVER)
            .setService(ScheduledJobService.class)
            .setTag("UniqueTagForYourJob")
            .setReplaceCurrent(false)
            .setRecurring(true)
            .setTrigger(Trigger.executionWindow(0,20))
            .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .build();

but the service is getting called only once

blackHawk
  • 6,047
  • 13
  • 57
  • 100

1 Answers1

0

For periodic jobs the minimum interval is 15 minutes from Nougat. Try with a larger time interval

MarGin
  • 2,078
  • 1
  • 17
  • 28
  • thank you for pointing it out, also when api call goes phone wakes up, educate me when application is in running mode service calls will go or not? – blackHawk Aug 31 '18 at 06:19