I have this code below but it seems that the jobService gets trigger even when im not online. In later versions this works fine.
JobScheduler jobScheduler = (JobScheduler)getApplicationContext()
.getSystemService(JOB_SCHEDULER_SERVICE);
ComponentName componentName = new ComponentName(this, MyJob.class);
JobInfo jobInfo = new JobInfo.Builder(1, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_CELLULAR)
.setPersisted(true).build();
jobScheduler.schedule(jobInfo);
Comments
Post a Comment