EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

Conditional local notifications? #64

Closed yyankov closed 7 years ago

yyankov commented 7 years ago

Hi,

I need to show a local notification only if a certain condition is met. Is it possible create conditional local notifications?

agra1992 commented 7 years ago

Not sure what's the exact solution you are looking for, but you can simply put the LocalNotifications.schedule(...) call within an if block which checks the condition you are looking for. So only if the condition is met, it'll schedule the notification.

yyankov commented 7 years ago

Thanks for the tip. Unfortunately that would only do the job if the check could be made at the time that the notification is fired.

For example: at 1 PM the app won't have a way to know if a notification will be needed at 5 PM. So I was wondering if that is possible only with local notifications (without backend logic and push notification).

EddyVerbruggen commented 7 years ago

Nope.

template01 commented 6 years ago

Hey Eddy,

Sorry to comment on this old thread. Within the schedule-function it would be awesome if you could check a condition before firing the notification. I have a scenario where i want to schedule a notification every x-minutes if a specific condition is met. Do you have any ideas on how i could go about this?

Cheers, Lasse