How to send periodic local notifications to your users

Today, I want to talk about an Apple Framework: User Notifications.

Based on Apple’s website, this is a simple Framework that allows us to push user-facing notifications to the user’s device from a server, or generate them locally from our app.

I will not cover all the functionalities that this Framework provides, and instead just focus in in a simple problem that I had:

Send a periodically notification to the user only if some condition becomes true. For example, the notification that the Activity ring app (installed by default in all the Apple Watches) sends to the user every hour and 50 minutes if the user did not stand up in the last 50 minutes.

We can simplify the example like:

We want users do some task every day and alert them at 5 pm if they did not do the task yet. Basically, we can reset a bool variable at midnight and set it when the user does the task on the device, showing the notification at 5 pm if the variable is false.

Continue reading…