To make a long story short, I need to schedule notifications according to the phases of the moon. I’ve got code which will tell me what phase of the moon it is on any given day. Given that modern civilizations don’t follow lunar calendars, I’m having trouble figuring out how to schedule these notifications with Ionic.
Ideally, I’d want code that works sort of like a cron job; every day, check to see if today’s phase differs from yesterday’s. If so, notify!
However, it seems that’s not possible. I can schedule a notification for every day, but I don’t see any way to prevent a notification from being sent if a condition isn’t met.
Alternatively, I’ve tried coming up with a more complex solution:
Upon app start: - are there notifications scheduled? - yes: do nothing - no: schedule the first one for the next phase of the moon Upon notification being sent: - schedule a notification to be sent during the next phase of the moon
However, that second half appears to be difficult. I couldn’t figure out how to trigger the
localNotificationReceived event, and
localNotificationActionPerformed isn’t quite correct because I can’t assume the user will take action on the notification.
I also tried using the cordova-plugin-local-notifications package, which has a bit more functionality, but I couldn’t for the life of me figure out how to use it within a Capacitor/React project. Judging by their docs, though, I would still need to go the more complex route laid out above.
I’m not really sure how to accomplish what I need to, and the docs are incredibly slim. Any help would be appreciated.