@Test public void testScheduleBroadcasts() { JobInfo job = JobCreator.create(application) .setMinimumLatency(TimeUnit.HOURS.toMillis(2)) .setOverrideDeadline(TimeUnit.DAYS.toMillis(1)) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) .setPersisted(true) .build(); scheduler.schedule(job); Intent intent = getLastBroadcastIntent(); assertNotNull(intent); assertIntentMatchesJobInfo(intent, job); PersistableBundle extras = new PersistableBundle(); extras.putString("test", "test"); job = JobCreator.create(application) .setExtras(extras) .setPeriodic(TimeUnit.MINUTES.toMillis(30)) .setRequiresCharging(true) .setRequiresDeviceIdle(true) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED) .build(); scheduler.schedule(job); intent = getLastBroadcastIntent(); assertNotNull(intent); assertIntentMatchesJobInfo(intent, job); job = JobCreator.create(application) .setRequiredNetworkType(JobInfo.NETWORK_TYPE_NOT_ROAMING) .addTriggerContentUri(new JobInfo.TriggerContentUri(Uri.parse("doist.com"), 0)) .addTriggerContentUri(new JobInfo.TriggerContentUri( Uri.parse("todoist.com"), JobInfo.TriggerContentUri.FLAG_NOTIFY_FOR_DESCENDANTS)) .addTriggerContentUri(new JobInfo.TriggerContentUri(Uri.parse("twist.com"), 0)) .build(); scheduler.schedule(job); intent = getLastBroadcastIntent(); assertNotNull(intent); assertIntentMatchesJobInfo(intent, job); }
@Override public int schedule(JobInfo job) { context.sendBroadcast(getScheduleIntent(job)); return RESULT_SUCCESS; }
GcmScheduler extends Scheduler { @Override public int schedule(JobInfo job) { context.sendBroadcast(getScheduleIntent(job)); return RESULT_SUCCESS; } }
GcmScheduler extends Scheduler { @Override public int schedule(JobInfo job) { context.sendBroadcast(getScheduleIntent(job)); return RESULT_SUCCESS; } GcmScheduler(Context context); }
GcmScheduler extends Scheduler { @Override public int schedule(JobInfo job) { context.sendBroadcast(getScheduleIntent(job)); return RESULT_SUCCESS; } GcmScheduler(Context context); @Override int schedule(JobInfo job); @Override void cancel(int jobId); @Override void cancelAll(); @NonNull @Override String getTag(); }
GcmScheduler extends Scheduler { @Override public int schedule(JobInfo job) { context.sendBroadcast(getScheduleIntent(job)); return RESULT_SUCCESS; } GcmScheduler(Context context); @Override int schedule(JobInfo job); @Override void cancel(int jobId); @Override void cancelAll(); @NonNull @Override String getTag(); static final String TAG; }