Repeat local notification scheduling for specified time period

I have the following use case: I want to schedule a notification daily at time A, starting on date X and ending on date Y. As far as I can tell from the docs, I can’t achieve this with the repeat=‘day’ option to scheduleLocalNotificationAsync because I can’t set an end date. (Does it ever even make sense to continue notifications in perpetuity or whatever max the os sets?)

There are two ways I can think of doing this:

  1. Set repeat=‘day’, store the notification ID, and then cancel the notification after the last day. The problem with this is that the user will have to open the app sometime on the last day in order for the cancel code to run. That may or may not happen.

  2. Schedule every single daily notification separately for the time period. This can be up to a couple months. Can anyone see an issue with doing this?

What’s the best practice, if any, here? Am I missing something?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.