I'm trying to create a recurring async task to call a web service with JobScheduler and JobService. But my idea was to try and execute this task once a day, and always at the same hour. Maybe even letting the user update the hour of the date the task is fired up.
Does the JobInfo.Builder supports this posibility? Because I was using "setPeriodic", but I don't think this is posible.
Should I use better the AlarmManager for this functionality?
This is the code that invokes the service right now:
private void launchCheckShowStatusJob(){
ComponentName serviceComponent = new ComponentName(this, CheckShowsStatusService.class);
JobInfo.Builder builder = new JobInfo.Builder(jobId++, serviceComponent);
builder.setMinimumLatency(0);
builder.setPeriodic(5*1000); //Every 5 minutes, can this be use to set a dayly task?
builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); //Require any network
builder.setRequiresCharging(false);
JobScheduler jobScheduler = (JobScheduler) getApplication().getSystemService(Context.JOB_SCHEDULER_SERVICE);
jobScheduler.schedule(builder.build());
}