I'm using firebase job dispatcher and I'm programming a simple periodic job that should run every minute or so when there is internet connection. I know that jobs don't run exactly on time because they wanted to improve the battery life and allow other apps to work as well but the delay is way too long. it can reach 25 minutes which is too long compared to the wanted 1 minute. Is there a way to make the periodic jobs run at least every 3-5 minutes instead ?
Thix is how I program the periodic task:
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(MainActivity.this));
Job myJob = dispatcher.newJobBuilder()
// the JobService that will be called
.setService(MyJobService.class)
// uniquely identifies the job
.setTag("my-unique-tag")
.setRecurring(true)
.setLifetime(Lifetime.FOREVER)
// start between 0 and 10 seconds from now
.setTrigger(Trigger.executionWindow(0, 10))
.setReplaceCurrent(true)
.setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
// constraints that need to be satisfied for the job to run
.setConstraints(
// only run on an unmetered network
Constraint.ON_UNMETERED_NETWORK
)
.build();
dispatcher.mustSchedule(myJob);