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 class
ShadowAlarmManager.ScheduledAlarm
Container 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 void
cancel(AlarmManager.OnAlarmListener listener)
protected void
cancel(PendingIntent operation)
protected boolean
canScheduleExactAlarms()
Returns the schedule exact alarm state set bysetCanScheduleExactAlarms(boolean)
.protected AlarmManager.AlarmClockInfo
getNextAlarmClock()
ShadowAlarmManager.ScheduledAlarm
getNextScheduledAlarm()
List<ShadowAlarmManager.ScheduledAlarm>
getScheduledAlarms()
ShadowAlarmManager.ScheduledAlarm
peekNextScheduledAlarm()
static void
reset()
protected void
set(int type, long triggerAtTime, PendingIntent operation)
protected void
set(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler)
protected void
setAlarmClock(AlarmManager.AlarmClockInfo info, PendingIntent operation)
protected void
setAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation)
static void
setCanScheduleExactAlarms(boolean scheduleExactAlarms)
Sets the schedule exact alarm state reported byAlarmManager.canScheduleExactAlarms()
, but has no effect otherwise.protected void
setExact(int type, long triggerAtTime, PendingIntent operation)
protected void
setExact(int type, long triggerAtTime, String tag, AlarmManager.OnAlarmListener listener, Handler targetHandler)
protected void
setExactAndAllowWhileIdle(int type, long triggerAtTime, PendingIntent operation)
protected void
setInexactRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation)
protected void
setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)
protected void
setTimeZone(String timeZone)
protected void
setWindow(int type, long windowStartMillis, long windowLengthMillis, PendingIntent operation)
protected void
setWindow(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.
-
-