I used Jobschuler for sending notification every x minutes(determined dynamically) like this
ComponentName componentName = new ComponentName(context,ClsJobService.class);
JobInfo.Builder builder = new JobInfo.Builder(0, componentName)
.setPeriodic(duration * 60 * 1000); //setting in millisecond
JobScheduler jobScheduler = (JobScheduler) context.getSystemService (Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(builder.build());
and its working great it sends notification on time defined in JobService
now how can I convert it into firebase job scheduler, I did like this
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
Job job = dispatcher.newJobBuilder()
.setService(ClsJobService.class)
.setTag("notification") // uniquely identifies the job
.setTrigger(Trigger.executionWindow(0, duration * 60))
.setLifetime(Lifetime.FOREVER)
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.setRecurring(true)
.build();
dispatcher.mustSchedule(job);
but I sends notification only once when schedules, and after that not