I have the following question about how JobScheduler works:
I am creating an example to replicate the operation of the AlarmManager in JobScheduler, but the JobScheduler example does not run after 15 days as an AlarmManager. Is it possible to execute a task every 15 days (or x days) using JobScheduler as in an AlarmManager?
// 15 días
private static final int PERIOD_MS = 15 * (1000 * 60 * 60 * 24);
AlarmManager
Intent newIntent = new Intent(context, BackgroundIntentService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 1, newIntent,PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
manager.setRepeating(AlarmManager.RTC, System.currentTimeMillis() + PERIOD_MS, PERIOD_MS,pendingIntent);
JobScheduler
ComponentName serviceComponent = new ComponentName(context, BackgroundJobService.class);
JobInfo.Builder builder = new JobInfo.Builder(0, serviceComponent);
//builder.setPeriodic(PERIOD_MS);
builder.setMinimumLatency(PERIOD_MS);
builder.setOverrideDeadline(PERIOD_MS);
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(builder.build());
Thank you in advance ...
Greetings.