NotificationServiceStarter.java :  » Task-Manager » kast » de » wilanthaou » kast » Android Open Source

Android Open Source » Task Manager » kast 
kast » de » wilanthaou » kast » NotificationServiceStarter.java
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.");
      }
    }
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.