1

I have to create a pills reminder that warns user with local notifications. The user would set pills time with different parameters :

  • start date
  • end date
  • hour
  • specific week days

I have some doubts about how to manage these parameters with local notifications:

Start Date:

Ok, Start date would be the firedate property

End Date:

How can I stop repetition at a specific day ? I think the unique way would be create every single notifications within the range Start-End date without repetition.

Specific Week Days

If user wants to set monday and friday, have i to manage these 2 days with 2 different notifications with weekly repetition and with firedate equal to the first "monday"/"friday" available ?

MatterGoal
  • 16,038
  • 19
  • 109
  • 186

1 Answers1

2

Start date

Yes, fireDate will do the trick.

End date

As you said, you can create the notifications within the range. Since you probably be using the repeatInterval property, you need another way to set the "end date".

Specific Week Days

Yes, that's the way to do it. You can't set your own repeating intervals, so setting one notification for mondays and another for fridays is fine.

My recommendation

It seems you'll be using pretty specific intervals in your notifications. The repeatInterval property has a huge limitation, so you must find a way to handle all your notifications without reaching the 64 limit of scheduled notifications (see Apple documentation).

These are the options:

1.If you think that your user is not going to schedule more that 64 notifications at the same time, schedule all the notifications within the range. Although, this is dangerous since most of the time we don't know how many notifications the user is going to need.

2.Another option is to use a queue of notifications, check how many notifications left and schedule more if needed. This way is better because is really difficult to reach the limit. I explain how to do this here.

Community
  • 1
  • 1
Eduardo
  • 1,383
  • 8
  • 13