0

I'm looking for a way to schedule notifications set by the user, which will notify all the devices they are using my app on.

Currently I'm using firestore to store the users data, including when the notification is due, and AlarmManager to set the alarms. The problem with this is that the user can set the notification on one device, but it's not synced to their other devices.

My plan is to use scheduled cloud functions, and then cloud messaging to notify the user on all devices. However I can't seem to find a way to update or cancel the cloud functions. Users could have multiple notifications set at one time.

How could I go about doing this, or is there a better way?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
DE_
  • 113
  • 7

1 Answers1

3

While you can run Cloud Functions on a schedule, that schedule is configured in your code/when you deploy the Function. There is no dynamic scheduling built into Cloud Functions.

It is possible to build dynamic scheduling in a few ways, most popularly by using Cloud Scheduler. Instead of repeating the same information here, I'll list some great tutorials and previous questions:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Thanks very much, never imagined a Firebase engineer would answer my question. Cloud Scheduler looks like it could be what I'm after. This is the last hurdle before publishing my app. – DE_ Jun 02 '20 at 20:51