Repeat Alarm once in a week in android

六月ゝ 毕业季﹏ 提交于 2019-11-29 07:44:32
Leon Lucardie
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, Seconds, AlarmManager.INTERVAL_DAY, pendingIntent);

In this line you set the start time to the user selected day, but then set the interval to INTERVAL_DAY.

You should use INTERVAL_DAY * 7 to make sure it repeats on a weekly basis instead:

alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, Seconds, AlarmManager.INTERVAL_DAY * 7, pendingIntent);

Is your alarm getting triggered everyday or every hour ?

I am supposing your in_Date is an indicator to choose daily alarm or for specific days .

My idea-> set the alarm for all days, check your day condition in the alarm receiver .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!