简体   繁体   中英

How to trigger Firebase notifications using timestamp field?

I am developing an app using Firebase as a backend with flutter. I am trying to add notifications functionality to the app. I know that firebase has push_notification service and most tutorials that I found are talking about how to set it for messaging apps. However, I am trying to notify the user based on the timestamp field in one of the documents in the database. I am not sure if there is a way to trigger the notifications locally (client side) or from the firebase.

Suppose the user has a document in the database for each assignment and each assignment has a due date as a filed in the database. I want to notify the user 24 hours before the assignment is due. Or possibly give the user the option to choose number of days/hours to be notified before each assignment is due.

Is there a way to set this functionality from firebase? How would you schedule the push-notification to be triggered?

Is there a way to set this functionality locally (client side)? How?

There are no built-in features to schedule notifications in Firebase based on a dynamic timestamp. Follow the following steps:

  1. Setup Firebase Cloud Functions to send per device token-based Notifications. You need to upgrade to the Blaze plan to use these functionalities.

    How to send Notifications using Firebase Functions

  2. You can use node-schedule or Cloud Scheduler in Firebase Functions . Or alternatively, if a periodic timer solves your problem you can use pub-sub scheduler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM