com.stringsandints.inventium.khlrooster.services
Class AlarmService

java.lang.Object
  extended by Service
      extended by com.stringsandints.inventium.khlrooster.services.AlarmService

public class AlarmService
extends Service

AlarmService manages the application's alarms.


Field Summary
static java.lang.String ALARM_OFF
           
static java.lang.String ALARM_ON
           
(package private)  AlarmManager mgr
           
static java.lang.String SILENT_ON
           
static java.lang.String VIBRATE_OFF
           
static java.lang.String VIBRATE_ON
           
 
Constructor Summary
AlarmService()
           
 
Method Summary
 void adjustAlarms(int timeBeforeLesson, int newTimeBeforeLesson, int timeUntilAlarm, int newTimeUntilAlarm)
          This method first cancels all alarms already set for the date.
private  void handleEvent(Intent intent)
          This method gets the data needed for the alarms from the properties and gets the old data from the intent.
 IBinder onBind(Intent intent)
           
 void onCreate()
           
 void onStart(Intent intent, int startId)
           
 int onStartCommand(Intent intent, int flags, int startId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mgr

AlarmManager mgr

VIBRATE_ON

public static java.lang.String VIBRATE_ON

VIBRATE_OFF

public static java.lang.String VIBRATE_OFF

ALARM_ON

public static java.lang.String ALARM_ON

ALARM_OFF

public static java.lang.String ALARM_OFF

SILENT_ON

public static java.lang.String SILENT_ON
Constructor Detail

AlarmService

public AlarmService()
Method Detail

onCreate

public void onCreate()

onStart

public void onStart(Intent intent,
                    int startId)

onStartCommand

public int onStartCommand(Intent intent,
                          int flags,
                          int startId)

onBind

public IBinder onBind(Intent intent)

handleEvent

private void handleEvent(Intent intent)
This method gets the data needed for the alarms from the properties and gets the old data from the intent. It then calls the adjustAlarms method.

Parameters:
intent -

adjustAlarms

public void adjustAlarms(int timeBeforeLesson,
                         int newTimeBeforeLesson,
                         int timeUntilAlarm,
                         int newTimeUntilAlarm)
This method first cancels all alarms already set for the date. It adds the alarms to set the phone to vibrate and sets the alarmClock for the next day.

Parameters:
timeBeforeLesson: - Amount of milliseconds the alarms goes off before the start of the lesson.
newTimeBeforeLesson: - Old value of timeBeforeLesson.
timeUntilAlarm: - Amount of milliseconds, before the first hour, the alarmClock should go of.
newTimeUntilAlarm: - Old value of newTimeUntilAlarm.