Jobscheduler不在同一时间间隔内运行

时间:2019-04-27 10:07:47

标签: android

这是我在启动时运行的作业服务。而且它不会在每个相同的时间间隔上运行。

我的代码也在这里:

private JobScheduler mJobScheduler;
@Override
public void onReceive(Context context, Intent intent) {
    Log.e("bootreceived", "gmservicetest");

    mJobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
    JobInfo.Builder builder = new JobInfo.Builder(1, new ComponentName(context.getPackageName(), JobSchedulerService.class.getName()));
    builder.setPeriodic(10000);
    mJobScheduler.cancelAll();
    mJobScheduler.schedule(builder.build());
}
  

04-27 12:57:11.343 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest 04-27 12:57:23.643   30163-30163 / net.r1p.test.myapplication E / gmservicetest:gmservicetest   04-27 12:57:35.153 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest 04-27 12:57:53.733   30163-30163 / net.r1p.test.myapplication E / gmservicetest:gmservicetest   04-27 12:58:23.923 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest 04-27 12:58:53.783   30163-30163 / net.r1p.test.myapplication E / gmservicetest:gmservicetest   04-27 13:00:22.063 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest 04-27 13:02:22.133   30163-30163 / net.r1p.test.myapplication E / gmservicetest:gmservicetest   04-27 13:03:52.093 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest 04-27 13:06:04.283   30163-30163 / net.r1p.test.myapplication E / gmservicetest:gmservicetest   04-27 13:06:25.313 30163-30163 / net.r1p.test.myapplication   E / gmservicetest:gmservicetest

0 个答案:

没有答案