@Override public void onReceive(Context context, Intent intent) { Log.d(LOG_TAG, "Receiver called"); String action = intent.getAction(); if (action == null) { return; } Log.v(LOG_TAG, "Receiver called with action: " + action); if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { syncChecking(context); } else if (action.equals(Veecheck.getRescheduleAction(context))) { syncChecking(context); } else if (action.equals(Veecheck.getConsiderAction(context))) { considerChecking(context); } }
/** * Constructs a {@link PendingIntent} that will be broadcast by the {@link AlarmManager} to prompt * this {@link BroadcastReceiver} to consider checking for updates. * * @param context the context in which the {@link BroadcastReceiver} is operating * @return an intent, pending to {@link Veecheck#getConsiderAction(Context)} */ private PendingIntent createCheckingIntent(Context context) { return PendingIntent.getBroadcast( context, 0, new Intent(Veecheck.getConsiderAction(context)), 0); }