Conditional local/push notifications for a reminder feature

Hi everyone,

Working on an IonicV5 (with Angular) mobile application, I would like to implement a local/push notification system working this way:

  1. If myArray is not empty at 6PM on D day, display the local notification to the user
  2. If myArray is empty at 6PM on D day, do not display the local notification to the user

As this notification system is key for a reminder feature, it should work even if the app is in background or killed. Another difficulty is that myArray can evolve between the D-1 day & the D day, as elements can be added or deleted in the meantime (making scheduling complicated).

I was considering working with https://ionicframework.com/docs/native/local-notifications (but can change if another solution seems better).

Could someone advice to help me developing such a thing?

Thanks a lot for your answers!

Andra

Hi Andra,

I’m trying to develop something similar myself.

I’ve been messing around with cronjobs (see https://cron-job.org/en/) which periodically checks my collection of notifications in a database. If the current time is greater than or equal to the scheduled time of the notification, then I push the notifications to the user’s device, and remove it from the collection.

It’s definitely still a work in progress since the timing is a little unreliable, which could just be an artifact of the cloud database I’m using.

Hopefully this helps.

Best regards,

Jordan.