Skip to content

List Alarms in Android

January 21st, 2015 - Software(1 min)

The other day I thought it would be a good idea to list set alarms in android, so I whipped up the following code:

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void listAlarms() {
    for (AlarmManager.AlarmClockInfo aci = mAlarmManager.getNextAlarmClock();
          aci != null;
          aci = mAlarmManager.getNextAlarmClock()) {
        Log.d(TAG, aci.getShowIntent().toString());
        Log.d(TAG, String.format("Trigger time: %d", aci.getTriggerTime()));
    }
}

Its idea is that we iterate through the alarm clocks set by the AlarmManager.

This works quite OK, but it doesn’t show periodic alarms :(, so it’s of no immediate use to me.

Therefore, I place it here in case someone finds this useful.

Share on
Reddit
Linked in
Whatsapp

A little experiment: