I'm trying to schedule a repeating alarm clock for a specific time (repeating weekly). The closest thing I've got is:
Getting the exact time:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, alarmHour);
calendar.set(Calendar.MINUTE, alarmMinute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.DATE, dateDelta);
long time = calendar.getTimeInMillis();
And then setting the alarm (where my question comes):
val clockInfo = AlarmManager.AlarmClockInfo(time, homePI)
alarmManager.setAlarmClock(clockInfo, alarmTriggerPI)
The problem is that to make it repeat, I'll need to manually trigger this code again.
If I use setRepeating
instead of setAlarmClock
then I lose the alarm notification (for newer phones).
Again the idea is just to start a normal alarm clock that if set to go off on a Friday, it will go off on every Friday.
Mike's comment is the right answer. In short, you have to manually trigger it.