@Test public void testCancelBroadcasts() { scheduler.cancel(0); Intent intent = getLastBroadcastIntent(); assertNotNull(intent); assertEquals(GcmScheduler.ACTION_SCHEDULE, intent.getAction()); assertEquals(GcmScheduler.PACKAGE_GMS, intent.getPackage()); assertEquals(GcmScheduler.SCHEDULER_ACTION_CANCEL_TASK, intent.getStringExtra(GcmScheduler.BUNDLE_PARAM_SCHEDULER_ACTION)); assertThat(intent.getParcelableExtra(GcmScheduler.BUNDLE_PARAM_TOKEN), instanceOf(PendingIntent.class)); ComponentName component = intent.getParcelableExtra(GcmScheduler.PARAM_COMPONENT); assertNotNull(component); assertEquals(GcmJobService.class.getName(), component.getClassName()); }
@Override public void cancel(int jobId) { context.sendBroadcast(getCancelIntent(jobId)); }
GcmScheduler extends Scheduler { @Override public void cancel(int jobId) { context.sendBroadcast(getCancelIntent(jobId)); } }
GcmScheduler extends Scheduler { @Override public void cancel(int jobId) { context.sendBroadcast(getCancelIntent(jobId)); } GcmScheduler(Context context); }
GcmScheduler extends Scheduler { @Override public void cancel(int jobId) { context.sendBroadcast(getCancelIntent(jobId)); } 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 void cancel(int jobId) { context.sendBroadcast(getCancelIntent(jobId)); } GcmScheduler(Context context); @Override int schedule(JobInfo job); @Override void cancel(int jobId); @Override void cancelAll(); @NonNull @Override String getTag(); static final String TAG; }