alarmmanager - Stratagy to set repeat days alarm in android -
i'm confused technique should use set , cancel repeat days alarm. have 2 conditions in mind.
- first set repeating days alarm @ once when alarm added.
- second should check @ time when alarm triggered there alarm next day or not.
problems conditions.
if set repeating days @ once , if user changed repeating days user added alarm @ 8:30 monday , wednesday , friday , user changed days monday , friday how can keep check on , cancel wednesday.
in second condition if check @ time when alarm goes-off next day , if user did not set alarm next day , set same alarm day after tomorrow? user set alarm @ monday 8:30 , same alarm set wednesday not tuesday how can check ?
it great pleasure if can give me kind of solution keep check on it.
you can start clock app of aosp https://android.googlesource.com/platform/packages/apps/deskclock/+/master
in specific check how alarms implemented in alarm class.
in case have schedule alarm "first next day" setted, when alarm fired, need method tell when next occurrence.
if user need modify alarm have unschedule existing alarm , reschedule it.
you should save alarm database because if device rebooted scheduled alarms lost. have register boot receiver , re-schedule alarms
Comments
Post a Comment