Time based notification


#1

hello@all

i’m new into development with ionic and need some help to build a required case.
i need to show a notification wich popup at a specific time. eg. everyday at 22:15
any tips?
thanks
isa


#2

I think your best best is to use $setInterval every minute or two, and then compare against current time. If it is the time you need, then fire off your pop-up.


#3

hi & thank you for your answer.
is this really the right way to do this? it seems a bit to ressource intensive to me… maybe i’m wrong… :frowning:
i’ll try

thanks
isa


#4

On iOS at least, the ‘correct’ way to do this, would be a local notification, which can be scheduled for a specific time. To use it in Ionic on Phonegap / Cordova, you would need to use a local notification plugin.


#5

@miklernout Thanks for the input. That’s a great idea. I wasn’t familiar with local notification.

With my suggestion, it would only work if the app was actually in use at the designated time. $setInterval wouldn’t run when an app was backgrounded.


#6

thanks for the inputs. i’ll try it this week
thanks
isa