@SuppressWarnings("deprecation") @Test public void testReceiversStartService() { new AlarmReceiver().onReceive(application, new Intent(Intent.ACTION_BOOT_COMPLETED)); assertEquals(shadowOf(application).getNextStartedService().getComponent().getClassName(), AlarmJobService.class.getName()); new AlarmReceiver.BatteryReceiver().onReceive(application, new Intent(Intent.ACTION_POWER_CONNECTED)); assertEquals(shadowOf(application).getNextStartedService().getComponent().getClassName(), AlarmJobService.class.getName()); new AlarmReceiver.StorageReceiver().onReceive(application, new Intent(Intent.ACTION_DEVICE_STORAGE_LOW)); assertEquals(shadowOf(application).getNextStartedService().getComponent().getClassName(), AlarmJobService.class.getName()); new AlarmReceiver.ConnectivityReceiver().onReceive( application, new Intent(ConnectivityManager.CONNECTIVITY_ACTION)); assertEquals(shadowOf(application).getNextStartedService().getComponent().getClassName(), AlarmJobService.class.getName()); }
@Override public void onReceive(Context context, Intent intent) { AlarmJobService.start(context); }
AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { AlarmJobService.start(context); } }
AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { AlarmJobService.start(context); }  }
AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { AlarmJobService.start(context); }  @Override void onReceive(Context context, Intent intent); }
AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { AlarmJobService.start(context); }  @Override void onReceive(Context context, Intent intent);  }