|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.content.Context
android.content.ContextWrapper
android.app.Service
android.app.IntentService
de.unikassel.android.sdcframework.app.scheduler.ScheduleService
public class ScheduleService
The scheduler background process.
Nested Class Summary | |
---|---|
private class |
ScheduleService.ScheduledAlarm
A simple structure to store the data for an alarm. |
Field Summary | |
---|---|
private static String |
ACTION
The action this service does process from intents. |
private AlarmManager |
alarmManager
The alarm manager |
private SimpleDateFormat |
df
Date formatter for log messages. |
private ApplicationPreferenceManager |
prefManager
The preference manager |
private PowerManager.WakeLock |
wakeLock
The wake lock to keep CPU running while service is active. |
Fields inherited from class android.app.Service |
---|
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY |
Constructor Summary | |
---|---|
ScheduleService()
Constructor |
Method Summary | |
---|---|
private void |
acquireWakeLock()
Does acquire the wake lock |
static Intent |
createIntent(Context applicationContext)
Does create an intent to start the schedule service |
private static PendingIntent |
createPendingIntent(Intent intent,
Context context)
Does create a pending intent to start this service. |
protected void |
execute(WeekdaySchedulerAction action)
Does execute a scheduled action |
private WeekdayScheduleEntry |
getEntryFromIntent(Intent intent,
WeeklySchedule schedule)
Method to get a scheduled valid entry from an intent (valid according to the given schedule ). |
private ScheduleService.ScheduledAlarm |
getNextAlarm(WeeklySchedule schedule,
Calendar now,
WeekdayScheduleEntry lastScheduledEntry)
Method to calculate the next alarm based on time and a given schedule. |
private PowerManager.WakeLock |
getWakeLock()
Getter for the wake lock |
void |
onCreate()
|
void |
onDestroy()
|
protected void |
onHandleIntent(Intent intent)
|
private void |
releaseWakeLock()
Does release the wake lock |
private void |
setAlarm(ScheduleService.ScheduledAlarm alarm)
Method to set a new alarm for next event. |
private void |
setWakeLock(PowerManager.WakeLock wakeLock)
Setter for the wake lock |
Methods inherited from class android.app.IntentService |
---|
onBind, onStart, onStartCommand, setIntentRedelivery |
Methods inherited from class android.app.Service |
---|
dump, finalize, getApplication, onConfigurationChanged, onLowMemory, onRebind, onUnbind, setForeground, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult |
Methods inherited from class android.content.Context |
---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String ACTION
private ApplicationPreferenceManager prefManager
private AlarmManager alarmManager
private final SimpleDateFormat df
private PowerManager.WakeLock wakeLock
Constructor Detail |
---|
public ScheduleService()
Method Detail |
---|
public void onCreate()
onCreate
in class IntentService
public void onDestroy()
onDestroy
in class IntentService
protected final void onHandleIntent(Intent intent)
onHandleIntent
in class IntentService
private final void setAlarm(ScheduleService.ScheduledAlarm alarm)
alarm
- the alarm to createprivate static final PendingIntent createPendingIntent(Intent intent, Context context)
intent
- the intent to wrapcontext
- the context
public static final Intent createIntent(Context applicationContext)
applicationContext
- the context
private final ScheduleService.ScheduledAlarm getNextAlarm(WeeklySchedule schedule, Calendar now, WeekdayScheduleEntry lastScheduledEntry)
schedule
- the current schedulenow
- the current time stamplastScheduledEntry
- the last scheduled entry if known
protected final void execute(WeekdaySchedulerAction action)
action
- the action to executeprivate final WeekdayScheduleEntry getEntryFromIntent(Intent intent, WeeklySchedule schedule)
intent
- the intent to create scheduled entry fromschedule
- the schedule to validate an existing entry for
private final void setWakeLock(PowerManager.WakeLock wakeLock)
wakeLock
- the wake lock to setprivate final PowerManager.WakeLock getWakeLock()
private final void releaseWakeLock()
private final void acquireWakeLock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |