Realtime Database triggers (pt. 1) with Cloud Functions for Firebase - Firecasts
Why Stack Overflow recommends it
Stack Overflow users link it when answering or asking about Firebase Realtime Database triggers, such as reacting to data changes with Cloud Functions or sending FCM messages after an update.
Recommended by 1 people across 1 different months, 2019 to 2021.
What it is
A short Firecasts episode from the official Firebase channel in which Doug explains how Cloud Functions triggers work for the Realtime Database. It focuses on the onCreate handler that fires when new data is written, and previews later videos on onUpdate and onDelete.
What people said
Recommends Agung · 2020-07 · Stack Overflow · on “Firebase cloud functions - schedule notification 5 times a day based on times stored on realtime database”
I think if you change the salat time in realtime database you have to use cloud function triggers like in here [this video] when it is triggered then you send Firebase Cloud Messaging to Android app bringing updated data, like in here [LINK] so you can update the value stored locally in the app to then make local notification. you can make it to not show up the notification when sending FCM in Android, just silent update.
Cites Constantin Beer · 2019-08 · Stack Overflow · on “Java HTTP calls in Firebase Realtime Database for data changes in a software”
If you would use spring you could use `@Scheduled` or if you would use cloud functions you could do this: [this video]
Cites HelloWorld · 2021-08 · Stack Overflow · on “Cloud functions in Firebase trigger are not part of the transaction update”
I am using the realtime database and I am using transactions to ensure the integrity of my data set. In my example below I am updating currentTime on every update. export const updateTime = functions.database.ref("/users/{userId}/projects/{projectId}") .onUpdate((snapshot) => { const beforeData = snapshot.before.val(); const afterData = snapshot.after.val(); if (beforeData.currentTime !== afterData.currentTime) { return Promise.resolve(); } else { return snapshot.after.ref.update( {currentTime: new Date().getTime()}) .catch((err) =>{ console.error(err); }); } }); It seems the cloud function is not part of the transaction, but triggers multiple updates in my clients, which I try to avoid. For