Search code examples
androidevernoteandroid-job

Setting interval in Evernote Android-jobs for less than 15 minutes


I am using Evernote Android Jobs library to schedule task on my Android 8.1.0. The default minimum interval of periodic jobs is 15 minutes which is making debugging time-consuming. I found an article which says that we can use

    JobManager.instance().getConfig().setAllowSmallerIntervalsForMarshmallow(true);

for shorter intervals in debugging but I am getting a squiggly line under getConfig() when I am using this. How to reduce the interval time?

Android-jobs version 1.2.6


Solution

  • The method setAllowSmallerIntervalsForMarshmallow(true) is deprecated and no longer in use in the library version 1.2.6 .We can use the following code to start the jobs.

    NOTE: This should only be used for debugging and not in production.

        private void runJobImmediately() {
        new JobRequest.Builder(DemoSyncJob.TAG)
            .startNow()
            .build()
            .schedule();
       }