R
R
Rogue852020-01-13 02:49:54
iOS
Rogue85, 2020-01-13 02:49:54

How to periodically check the base and send User Notification in iOS 13?

In the application, the user adds various objects for which two key dates are set. On each of these dates, you need to send a notification, but the second accuracy is not important.
I tried to start a BackgroundTask with a periodic check of the database and sending a notification. But the time of calling the task depends, apparently, on the cycles of the satellite of Saturn. It is all called once a month, if you're lucky.
There is an idea to do it through calendar notifications, but I'm not sure if this will work exactly and what the side effects will be. Each time you edit an object, you will need to demolish notifications and set new ones.
Actually, the question is: what's the best way to do what I want if I don't want to reinvent the wheel?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Vorobei, 2020-01-13
@Rogue85

After closing the application , in the applicationDidEnterBackground method iterate through the elements in the database and set local push notifications. Here you can also update the badge, if it is used.
Remember about the limit of 64 pushes , if you need more - your backend.
It's not worth waking up via BackgroundTask for notifications)

N
NSA-bot, 2020-01-13
@NSA-bot

For the Background mode, there is a certain list of possible tasks, and yours is unlikely to fit, so most likely it just pauses.
Local calendar notifications are great for this and will fire exactly the way you want.

B
briahas, 2020-01-13
@briahas

All this is done on the server.
Locally - probably through the calendar it is possible, but I did not do this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question