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
All Methods Static Methods Instance Methods Concrete Methods 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)
-
-
-
Method Detail
-
reset
@Resetter public static void reset()
-
setTimeZone
@Implementation protected void setTimeZone(String timeZone)
-
set
@Implementation protected void set(int type, long triggerAtTime, PendingIntent operation)
-
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
@Implementation(minSdk=21) protected AlarmManager.AlarmClockInfo getNextAlarmClock()
-
getNextScheduledAlarm
public ShadowAlarmManager.ScheduledAlarm getNextScheduledAlarm()
- Returns:
- the next scheduled alarm after consuming it
-
peekNextScheduledAlarm
public ShadowAlarmManager.ScheduledAlarm peekNextScheduledAlarm()
- Returns:
- the most recently scheduled alarm without consuming it
-
getScheduledAlarms
public List<ShadowAlarmManager.ScheduledAlarm> getScheduledAlarms()
- Returns:
- all scheduled alarms
-
cancel
@Implementation protected void cancel(PendingIntent operation)
-
cancel
@Implementation(minSdk=24) protected void cancel(AlarmManager.OnAlarmListener listener)
-
canScheduleExactAlarms
@Implementation(minSdk=31) protected boolean 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.
-
-