Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle recurring push notification reminders in React Native

I'm working on a React Native app where I need to send recurring push notifications at specific times. So for example, the user will toggle the app to remind them to do task X every day at 12:00pm and I want the app to send a push notification at 12:00pm (when the app is in the background) to remind the user to complete task X.

For the React Native app, I'm using expo and I've read up on their documentation; however, I'm not quite sure how to handle these reminders.

a) I don't know how to monitor recurring events, i.e. how can I set up the app to know when it's 12:00pm, especially given that the app will be running in the background or potentially not running at all, and

b) I'm not sure if these push notifications should be sent locally within the app or from the app's API/server.

Ideally, I would like to use expo's push notification feature, but I'm open to any suggestions as to how to get this set up! Thanks.

like image 543
ch1maera Avatar asked May 29 '18 06:05

ch1maera


1 Answers

a. ) You should look into node-cron or node-schedule for scheduled push notifications.

b.) It depends on the situation. If you are performing a complicated reminder, such as running a query to check if the task is completed, and sending a notification if it is not completed, then the scheduled push notifications should be sent remotely from the api/server. Else, you can use the react-native push notification to send a local scheduled notification.

like image 163
Jordan Daniels Avatar answered Nov 14 '22 12:11

Jordan Daniels