Skip to content Skip to sidebar Skip to footer

Android JobScheduler - Can't Create A Persistent Job

I am trying out the new JoScheduler API that has come with Android Lollipop. I have so far managed to successfully create and have a job run with a delay of 6000 milliseconds with

Solution 1:

I had the same issue, but then realized that I hadn't re-installed my app after adding the boot permission. So the app never got an opportunity to request the required permission when it was installed.

Once I uninstall and re-installed the app it works.

Note: My understanding is that Apps need to get their permission at install time. However I stand to be corrected here.


Solution 2:

Just as 43matthew said, It's probably caused by JobScheduler cache.

It's solved after device reboot.

PS: Make sure you have the following permission in your XML.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Solution 3:

It looks like the JobScheduler keeps a cache of uids that hold this permission: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/android/server/job/JobSchedulerService.java#736

Perhaps you added the permission, but the phone didn't restart and therefore the JobScheduler has not updated its cache?


Solution 4:

I had the same problem, I think your issue is that you are starting an intent service. You need to add the BIND_JOB permission to your intent service as well.

    <service
        android:name=".your.intent.service"
        android:enabled="true"
        android:exported="false"
        android:permission="android.permission.BIND_JOB_SERVICE"/>

Solution 5:

I noticed that if job scheduler is set to persist then you may fall into this error, remove

setPersist(true);

from scheduler


Post a Comment for "Android JobScheduler - Can't Create A Persistent Job"