Schedule weekly task
mhrpatel12 opened this issue · 2 comments
Is there a way to schedule a task on a particular day of week and repeat? Say, want to schedule a task which gets repeated on each Monday.
I'm aware about creating repeating tasks like, repeats every ten minutes or everyday.
Referred to this PR also, but couldn't figure out this can be incorporated for my use case.
Appreciate any help on this!
Have given this a try.
Code snipper below is for scheduling a task at every Monday of week at 11 Hours.
Not sure if this is a correct implementation or not.
`Calendar c1 = Calendar.getInstance();
c1.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
c1.set(Calendar.HOUR_OF_DAY, 11);
c1.set(Calendar.MINUTE, 0);
c1.set(Calendar.SECOND, 0);
c1.set(Calendar.MILLISECOND, 0);
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(Splash_onboarding.this));
Job myJob = dispatcher.newJobBuilder()
.setService(ScheduledNotificationService.class)
.setTag(dispatcherTag)
.setRecurring(true)
.setLifetime(Lifetime.FOREVER)
.setTrigger(Trigger.executionWindow(Math.round(c1.getTime().getTime() / 1000), (Math.round(c1.getTime().getTime() / 1000)) + 60))
.setReplaceCurrent(true)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.build();
dispatcher.mustSchedule(myJob);`
In April 2019 we announced that Firebase Job Dispatcher would be deprecated today, April 7th 2020. For this reason we are going to close all open issues and archive the repository. We will also stop supporting FJD for new app installations (such as those targeting sdk versions greater than Android Q). Existing apps that rely on FJD should continue to function as usual.
While we will no longer work on FJD, we encourage you to migrate to Work Manager which is a superior tool and fully supported by the Android team.
Thank you for taking the time to try the library and provide this feedback. We sincerely appreciate your effort and we apologize for not addressing it in time.