Repeat Alarm once in a week in android

前端 未结 2 1361
星月不相逢
星月不相逢 2020-12-18 06:42

I am trying to develop alarm functionality in a my app which runs on a week days specified by user on fixed time. Problem here is that my scheduler running for all days inst

相关标签:
2条回答
  • 2020-12-18 07:24

    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 .

    0 讨论(0)
  • 2020-12-18 07:35
    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);
    
    0 讨论(0)
提交回复
热议问题