apologies if this is a simple answer that I do not know. I am trying to set an alarm with alarm managers setAlarmClock(). My alarm goes off on the proper time, but it is random throughout the minute I set it at. For example, if I set it at 8:30, it will go off at 8:30, but it is random throughout the minute that it goes off. How do I get it to go off right as it turns 8:30.
val calendar: Calendar = Calendar.getInstance().apply {
timeInMillis = System.currentTimeMillis()
set(Calendar.HOUR_OF_DAY, 20)
set(Calendar.MINUTE, 31)
}
var trig: AlarmManager.AlarmClockInfo =
AlarmManager.AlarmClockInfo(calendar.timeInMillis, alarmIntent)
alarmMgr?.setAlarmClock(
trig,
alarmIntent
)