I am trying to schedule a periodic job to run every 15 mins by using evernote's android-job. The problem is job runs 2-3 times and then it doesn't run every 15 mins. Basically in span of 8 hours it ran almost 10-11 times when the device was sitting idle. Is there something I am doing wrong. The only requirement my job has is Network should be connected which was connected.
Does android-job library somewhat gurantees that job will run? This is my code for the job
public class TestNetworkJob extends Job {
public static final String TAG = "TestNetworkJob";
@NonNull
@Override
protected Result onRunJob(Params params) {
Timber.i("onRunJob");
RetrofitUtils.getInstance().postSlack("TestCall: " + DateTimeUtils.getLocalizedDateTimeString(System
.currentTimeMillis()));
return Result.SUCCESS;
}
public static JobRequest buildJobRequest() {
return new JobRequest.Builder(TAG)
.setUpdateCurrent(true)
.setRequiredNetworkType(JobRequest.NetworkType.CONNECTED)
.setPeriodic(TimeUnit.MINUTES.toMillis(15))
.build();
}
}