Local Notifications - Integral part of app

Hi guys, I am at my wits end. I am a experienced Angular developer but this was my first Ionic app. So simply put I want to activate a local notification at a certain time in the morning and then one in the afternoon again for a user to take his chronic medicine. Everything in the app works great but the notifications are killing me. So here is what seems to happen:

  • If a phone reboots the notifications simply never appear again UNLESS the user opens the app at least once. I should have mentioned I am using Cordova local notification plugin but it seems as if no one can agree if it should still show notifications after reboot or not. Bottom line is if the fact is that it can’t then I am screwed.

  • Second problem is that when I show a notification there is suppose to be a reminder 5 minutes later. How weird this even sounds sometimes it works perfectly other times the reminder is exactly the same time as the notification and the weirdest is that I have not even opened the app for two days.

  • My last issue which I do believe I resolved is that if a user changes his notification time let’s say from 7 am to 8 am then he would still receive the 7 am one. This one sort of made sense to to me as I was thinking the phone probably does not know the old one is not valid anymore so what I do now is to use this.localNotifications.cancelAll(); to clear all reminders and then rebuild them again every time a time is changed. This seems to work fine so I am just stating this for completeness sake.

Are Local Notifications something that are stable in Ionic or am I beating a dead horse here.

Thank you

Hi
Not sure if this is purely an Ionic issue

More of options in cordova and/or capacitor

While I have no experience we either in notifications I do hear sometimes about background tasks running etc?

The other option could be running service workers? I believe when the browser runs, all registered service workers run, irrespective if the app is open. E.g. push notifications on android via FCM

But I reckon, registering a service to run after reboot u need some native things going on

So u might find yourself coding those parts natively in a custom capacitor or cordova plugin

Thanks for that. I agree that probably not specific Ionic issue but probably Cordova issue (I did try with Capacitor but it is such a huge schlep to get every update to deploy to the device so that I can test) Unfortunately local notifications does not work on web so you can imagine the time it takes to test every time I make a change. Service workers I understand on PWA level but on device level I am at a bit lost. I was hoping that someone can tell me “Yes it can work” and the I will put in days if necessary or “Nopes, it does not work” and then I can pursue Push Notifications. My gut feeling however is local notifications can work, how does alarms for example work, unless Ionic cia Cordova and/or Capacitor simply can’t control that native implementation.

Understood. It does seem like something that someone wanted in the past. So the answer should be around

Good luck

:fist_right: :fist_left:

Andrew, must be honest I do not understand half of what you stating here but thanks for it. Hopefully Google will clear the mist for me a bit