Search code examples
androidserviceandroid-jobschedulerjobservice

Can't cancel and schedule Android Job Service again


I have job service that upload files to server. I'm trying to cancel and schedule it again after it but job isn't scheduling again. I do it like this:

    jobScheduler.cancel(UPLOADER_JOB_ID);
    jobScheduler.schedule(jobInfo);

This is happening on pre Android 8 devices.

Why I can't schedule it again by the code above?

Thanks in advance!

Possible Workaround

I found out that if I add minimum latency to a job for around 3 seconds it would work normally. Firstly cancel job and then schedule it with 3 sec latency. But this doesn't work on Xiaomi MiUi 8.


Solution

  • Possible Workaround

    I found out that if I add minimum latency to a job for around 3 seconds it would work normally. Firstly cancel job and then schedule it with 3 sec latency. But this doesn't work on Xiaomi MiUi 8.