Hello,
I'm interesting in a periodic job (once a week for example) that is fired at a specific time (for example at 4.00 PM)
I have read from this post
https://github.com/evernote/android-job/blob/master/FAQ.md#how-can-i-run-a-job-at-a-specific-time-once-a-day
that I can run a job every day once a day, but it is not my case.
If I set
new JobRequest.Builder( MY_TAG )`
.setExact( TimeUnit.HOURS.toMillis( 16 ) + TimeUnit.MINUTES.toMillis( 0 ))
.setPeriodic( TimeUnit.DAYS.toMillis( 7 ), TimeUnit.MINUTES.toMillis(5) )
.setPersisted(true)
.build()
.schedule();
I have this error "Can't call setExact() on a periodic job"
Can someone help me?
A periodic job can't be exact. A job is either exact or periodic. Periodic jobs are always inexact. That's simply the way how Android optimizes for longer battery life.
Ok
but can I fire a job every friday at 4.00 PM for example?
If it is not exact the 4.00 PM but 4.15 PM for me is the same
Yes
How can I do that?
I really don't want to answer that here. That's an issue tracker where people can report defects in the library. I suggest that you take a look at this sample and if that doesn't help, then ask this question at an appropriate place like Stackoverflow.
ok thaks
Hi,
The link mentioned in the above messages throws a 404, is there any way I can get to it?
That's the new link https://github.com/evernote/android-job/wiki/FAQ#how-can-i-run-a-job-at-a-specific-time-once-a-day
@mrpep80 I have your problem.
did you find anything bro?
Not Really Helped !!
I am also seeking for a solution.
@alifhasnain Have you has any solution yet ?
@hoangtrungnguyen Yeah I have solved my problem. I am using WorkManager now. I created a PeriodicWorkRequest and enqueued it as Unique Work so I only have one work running with a unique id. It periodically checks data from local database and fire the task with AlarmManager at an exact time.
@alifhasnain can you drop the example project?
Most helpful comment
I really don't want to answer that here. That's an issue tracker where people can report defects in the library. I suggest that you take a look at this sample and if that doesn't help, then ask this question at an appropriate place like Stackoverflow.