1

I want to trigger a Firebase push notification and in-app message when a specific time has elapsed after a Firebase event has occurred. How can I approach this? Can I use Firebase Functions to schedule an event? For some context: Lets say I press a button in my android app that triggers a Firebase event, then if I don't press the button in a week I want to receive a push notification (GCM) and a in-app message (FIAM) to remind me to push it. Whats the standard way to do this in Firebase?

user1171426
  • 69
  • 1
  • 9
  • "Can I use Firebase Functions to schedule an event?" You'll typically store the scheduled events as documents in Cloud Firestore, and then run a Cloud Function on a schedule that periodically checks what events need to be fired since the last time it ran. See https://stackoverflow.com/questions/55956317/how-to-use-scheduler-for-firebase-cloud-functions-with-realtime-database-analyti – Frank van Puffelen Jun 13 '19 at 14:34

1 Answers1

1

Firebase currently doesn't offering anything for scheuduling on a specific delay. You can poll the database using a scheduled function as Frank mentioned, but that's not going to give you granular scheduling (every 1 minute at best).

Since Firebase projects are also Google Cloud projects, you can instead use Cloud Tasks to arrange for a function to be executed at a specific time. It's non-trivial to set up, but you can have it trigger an HTTP function once, at the time you choose.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441