Android-job: [Help] How to delete a job?

Created on 3 Oct 2016  路  5Comments  路  Source: evernote/android-job

Hie!
We have a job which was configured in the previous version of the app to run periodically once a day to sync data from our server.
We no longer need to sync the said data. Can we just delete the Job class and remove it from the JobCreator? Or some other steps are required?

-Thanks.

question

Most helpful comment

No, that's not enough for periodic jobs. You need to cancel the job on all devices, otherwise the system still tries to execute your job. Because your job creator doesn't return a job, it'll stop executing the job for this interval, but it'll try again the next day in your case.

Simply call JobManager.instance().cancelAllForTag("Job-Tag"); and you should be good.

Does this help?

All 5 comments

No, that's not enough for periodic jobs. You need to cancel the job on all devices, otherwise the system still tries to execute your job. Because your job creator doesn't return a job, it'll stop executing the job for this interval, but it'll try again the next day in your case.

Simply call JobManager.instance().cancelAllForTag("Job-Tag"); and you should be good.

Does this help?

Thanks a lot for the info.. Was this a part of the FAQ and I missed it?
Will be closing the issue.

@vRallev Thanks. We should really have "How to cancel job" info in FAQ.

@vRallev How to get Job information like when it's scheduled?
Like :

Set<Job> jobs = JobManager.instance().getAllJobsForTag(Tasker.TAG);
        for (Job job : jobs) {
         String time  = job.getScheduledTime();
        }
Was this page helpful?
0 / 5 - 0 ratings