@Test public void testOnStartCommand_handlesNullIntent() { JobService service = spy(new ExampleJobService()); int startId = 7; try { service.onStartCommand(null, 0, startId); verify(service).stopSelf(startId); } catch (NullPointerException npe) { fail("Unexpected NullPointerException after calling onStartCommand with a null Intent."); } }
@Override @MainThread public final int onStartCommand(Intent intent, int flags, int startId) { stopSelf(startId); return START_NOT_STICKY; }
JobService extends Service { @Override @MainThread public final int onStartCommand(Intent intent, int flags, int startId) { stopSelf(startId); return START_NOT_STICKY; } }
JobService extends Service { @Override @MainThread public final int onStartCommand(Intent intent, int flags, int startId) { stopSelf(startId); return START_NOT_STICKY; }  }
JobService extends Service { @Override @MainThread public final int onStartCommand(Intent intent, int flags, int startId) { stopSelf(startId); return START_NOT_STICKY; }  @MainThread abstract boolean onStartJob(@NonNull JobParameters job); @MainThread abstract boolean onStopJob(@NonNull JobParameters job); @AnyThread final void jobFinished(@NonNull JobParameters job, boolean needsReschedule); @Override @MainThread final int onStartCommand(Intent intent, int flags, int startId); @Nullable @Override @MainThread final IBinder onBind(Intent intent); @Override @MainThread final boolean onUnbind(Intent intent); @Override @MainThread final void onRebind(Intent intent); @Override @MainThread final void onStart(Intent intent, int startId); @Override @MainThread final void onConfigurationChanged(Configuration newConfig); @Override @MainThread final void onTaskRemoved(Intent rootIntent); }
JobService extends Service { @Override @MainThread public final int onStartCommand(Intent intent, int flags, int startId) { stopSelf(startId); return START_NOT_STICKY; }  @MainThread abstract boolean onStartJob(@NonNull JobParameters job); @MainThread abstract boolean onStopJob(@NonNull JobParameters job); @AnyThread final void jobFinished(@NonNull JobParameters job, boolean needsReschedule); @Override @MainThread final int onStartCommand(Intent intent, int flags, int startId); @Nullable @Override @MainThread final IBinder onBind(Intent intent); @Override @MainThread final boolean onUnbind(Intent intent); @Override @MainThread final void onRebind(Intent intent); @Override @MainThread final void onStart(Intent intent, int startId); @Override @MainThread final void onConfigurationChanged(Configuration newConfig); @Override @MainThread final void onTaskRemoved(Intent rootIntent); static final int RESULT_SUCCESS; static final int RESULT_FAIL_RETRY; static final int RESULT_FAIL_NORETRY; }