Posts

Showing posts with the label job-scheduling

Notification not sent by JobService

Notification not sent by JobService So I have a notification set up in my JobService.class and I know for sure that it works. The problem is that I don't think my JobService is ever getting called. I want my app to check the database every couple hours and if it matches certain criterias it will send a notification. I start my JobService like this in my MainActivity : JobService.class JobService JobService MainActivity ComponentName componentName = new ComponentName(MainActivity.this, JobService.class); JobInfo info = new JobInfo.Builder(6484, componentName) .setPeriodic(1000 * 60 * 15) .build(); JobScheduler scheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE); if (scheduler != null) { scheduler.schedule(info); } And this is my JobService since it's too long. I cut off the code for the notification parts because it's too long. JobService @Override public boolean onStartJob(JobParameters jobParameters) { {/...