Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger notification from firebase at a specific time?

I am doing a fitness app in which I have to notify the user at a specific time from the date I have stored in firebase.

For example: I am saving a today's timestamp in firebase DB say "start_at":"timestamp", now I have to send a notification after 1 week from the date(timestamp) I stored.

It is similar to cron feature. I don't know exactly how to achieve it in firebase.

Is Anyone there to help me?

like image 858
Hira Avatar asked Dec 14 '17 13:12

Hira


People also ask

Can Firebase do push notifications?

Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web at no cost.


1 Answers

Firebase, and Google Cloud Platform in general, has no feature that let’s you schedule a notification or a Cloud Function trigger programmatically.

You have to choices:

  • Write a Cloud Function that will be triggered from Google App Engine with a frequency (es. 1 hour). Here is the explanation on how to schedule the execution.
  • Setup your own server to send notifications through the API of FCM. If you use Node.js you can use node-cron.
like image 161
alessionossa Avatar answered Oct 23 '22 03:10

alessionossa