@Test public void testSchedule_failsWhenPlayServicesIsUnavailable() throws Exception { markBackendUnavailable(); mockPackageManagerInfo(); Job job = null; try { job = dispatcher .newJobBuilder() .setService(TestJobService.class) .setTag("foobar") .setConstraints(Constraint.DEVICE_CHARGING) .setTrigger(Trigger.executionWindow(0, 60)) .build(); } catch (ValidationEnforcer.ValidationException ve) { fail(TextUtils.join("\n", ve.getErrors())); } assertEquals( "Expected schedule() request to fail when backend is unavailable", FirebaseJobDispatcher.SCHEDULE_RESULT_NO_DRIVER_AVAILABLE, dispatcher.schedule(job)); }
@Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); @Override boolean isAvailable(); @Override @ScheduleResult int schedule(@NonNull Job job); @Override int cancel(@NonNull String tag); @Override int cancelAll(); @NonNull @Override JobValidator getValidator(); }
GooglePlayDriver implements Driver { @Override @ScheduleResult public int schedule(@NonNull Job job) { GooglePlayReceiver.onSchedule(job); context.sendBroadcast(createScheduleRequest(job)); return FirebaseJobDispatcher.SCHEDULE_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); @Override boolean isAvailable(); @Override @ScheduleResult int schedule(@NonNull Job job); @Override int cancel(@NonNull String tag); @Override int cancelAll(); @NonNull @Override JobValidator getValidator();  }