我在下面有此代码,但似乎jobService即使在5秒后也永远不会触发。在更高的版本中,此功能正常。
JobScheduler jobScheduler = (JobScheduler)getApplicationContext()
.getSystemService(JOB_SCHEDULER_SERVICE);
ComponentName componentName = new ComponentName(this, MyJob.class);
JobInfo jobInfo = new JobInfo.Builder(1, componentName)
.setMinimumLatency(5000)
.setPersisted(true).build();
jobScheduler.schedule(jobInfo);