package de.wilanthaou.kast;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
/**
* {@link BroadcastReceiver} that starts the {@link NotificationService} when
* booting is completed.
*
* @author Alexander Metzner
*
*/
public class NotificationServiceStarter extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)
|| intent.getAction().equals(Intent.ACTION_USER_PRESENT)) {
if (Preferences.getSendAlarms(context)) {
Log.d(KastConstants.LOGGING_TAG, "Starting kast notification service");
context.startService(new Intent(context, NotificationService.class));
} else {
Log.d(KastConstants.LOGGING_TAG, "Not going to start the notification service.");
}
}
}
}
|