I'm trying to use the android Job Scheduler API and all I'm trying to do is have the Job Scheduler run every 5 seconds. However when I run it, the corresponding service is hit every two minutes. I have a log that documents every time the service is hit. I'm not sure why this is happening. Could the Job Scheduler have a minimum interval time. My code is simply...
JobInfo jobInfo = new JobInfo.Builder(1, new ComponentName(this, UpdateDatabaseService.class))
.setPeriodic(5000)
.build();
JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(jobInfo);
The problem originally arose when I was trying to run a daily task but it would trigger the service multiple times within that day and wouldn't follow the time guideline.
Let me know what you think.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…