Package org.robolectric.shadows
Class ShadowAlarmManager
java.lang.Object
org.robolectric.shadows.ShadowAlarmManager
@Implements(android.app.AlarmManager.class) public class ShadowAlarmManager extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShadowAlarmManager.ScheduledAlarmContainer object to hold a PendingIntent and parameters describing when to send it. -
Constructor Summary
Constructors Constructor Description ShadowAlarmManager() -
Method Summary
Modifier and Type Method Description protected voidcancel(AlarmManager.OnAlarmListener listener)protected voidcancel(PendingIntent operation)protected booleancanScheduleExactAlarms()Returns the schedule exact alarm state set bysetCanScheduleExactAlarms(boolean).protected AlarmManager.AlarmClockInfogetNextAlarmClock()ShadowAlarmManager.ScheduledAlarmgetNextScheduledAlarm()List<ShadowAlarmManager.ScheduledAlarm>getScheduledAlarms()ShadowAlarmManager.ScheduledAlarmpeekNextScheduledAlarm()static voidreset()protected voidset(int type, long triggerAtTime, PendingIntent operation)protected voidset(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler)protected voidsetAlarmClock(AlarmManager.AlarmClockInfo info, PendingIntent operation)protected voidsetAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation)static voidsetCanScheduleExactAlarms(boolean scheduleExactAlarms)Sets the schedule exact alarm state reported byAlarmManager.canScheduleExactAlarms(), but has no effect otherwise.protected voidsetExact(int type, long triggerAtTime, PendingIntent operation)protected voidsetExact(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler)protected voidsetExactAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation)protected voidsetInexactRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation)protected voidsetRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)protected voidsetTimeZone(String timeZone)protected voidsetWindow(int type, long windowStartMillis, long windowLengthMillis, PendingIntent operation)protected voidsetWindow(int type, long windowStartMillis, long windowLengthMillis, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler)
-
Constructor Details
-
ShadowAlarmManager
public ShadowAlarmManager()
-
-
Method Details
-
reset
-
setTimeZone
-
set
-
set
@Implementation(minSdk=24) protected void set(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler) -
setExact
@Implementation(minSdk=19) protected void setExact(int type, long triggerAtTime, PendingIntent operation) -
setExact
@Implementation(minSdk=24) protected void setExact(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler) -
setWindow
@Implementation(minSdk=19) protected void setWindow(int type, long windowStartMillis, long windowLengthMillis, PendingIntent operation) -
setWindow
@Implementation(minSdk=24) protected void setWindow(int type, long windowStartMillis, long windowLengthMillis, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler) -
setAndAllowWhileIdle
@Implementation(minSdk=23) protected void setAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation) -
setExactAndAllowWhileIdle
@Implementation(minSdk=23) protected void setExactAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation) -
setRepeating
@Implementation protected void setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation) -
setInexactRepeating
@Implementation protected void setInexactRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation) -
setAlarmClock
@Implementation(minSdk=21) protected void setAlarmClock(AlarmManager.AlarmClockInfo info, PendingIntent operation) -
getNextAlarmClock
-
getNextScheduledAlarm
- Returns:
- the next scheduled alarm after consuming it
-
peekNextScheduledAlarm
- Returns:
- the most recently scheduled alarm without consuming it
-
getScheduledAlarms
- Returns:
- all scheduled alarms
-
cancel
-
cancel
-
canScheduleExactAlarms
Returns the schedule exact alarm state set bysetCanScheduleExactAlarms(boolean). -
setCanScheduleExactAlarms
public static void setCanScheduleExactAlarms(boolean scheduleExactAlarms)Sets the schedule exact alarm state reported byAlarmManager.canScheduleExactAlarms(), but has no effect otherwise.
-