I have set up an alarm using the Alarm manager and to test it changed the time of the device manually. At this time the alarm not triggers, but if we wait till the time it gets triggered. Is there any better option to test the alarm?
The alarm setting code is given below.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
total,
operation
)
} else {
alarmManager.setExact(
AlarmManager.RTC_WAKEUP,
total,
operation
)
}