When does Android JobScheduler remove completed Job from getAllPendingJobs()?

Viewed 666

I am investigating android JobScheduler in Android O preview.

It all works fine while I schedule my one off job within a single Activity.

I can see that my job appears in the List<JobInfo>'s returned by getAllPendingJobs() while it is pending/running. It is removed from this list once it has completed.

However when I start the job from Activity A and switch to Activity B the job is not being removed from the getAllPendingJobs() List<JobInfo>.

Why is my completed job being kept in the AllPendingJobs List<>?

This is how I start my Job

    syncJobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
    final JobInfo.Builder jobInfoBuilder = new JobInfo.Builder(SYNC_JOB_SCHEDULER_ID, new ComponentName(getPackageName(), JobSchedulerMendeleySyncable.class.getName()));
    jobInfoBuilder.setMinimumLatency(MIN_LATENCY_MILLIS_ZERO);
    jobInfoBuilder.setBackoffCriteria(INITIAL_BACKOFF_MILLIS, BACKOFF_POLICY_EXPONENTIAL);
    final int jobScheduledResult = syncJobScheduler.schedule(jobInfoBuilder.build());

UPDATE 0001 How do i detect a scheduled job has completed?

0 Answers
Related