如何使用 Firebase Functions 将 FCM 发送给用户?
How can I use Firebase Functions to send FCM to user?
Firebase 目前推出 Firebase Functions 添加服务器端代码
我想知道当数据库发生某些变化时,是否可以通过这些函数调用 FCM 通知。
Firebase SDK for Cloud Functions includes the Firebase Admin SDK, you can find an example that we made here Send Firebase Cloud Messaging notifications for new followers
简述:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.foo = functions.database.ref('/bar').onWrite(event => {
const tokens = ...;
const payload = ...;
return admin.messaging().sendToDevice(tokens, payload);
})
Firebase 目前推出 Firebase Functions 添加服务器端代码
我想知道当数据库发生某些变化时,是否可以通过这些函数调用 FCM 通知。
Firebase SDK for Cloud Functions includes the Firebase Admin SDK, you can find an example that we made here Send Firebase Cloud Messaging notifications for new followers
简述:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.foo = functions.database.ref('/bar').onWrite(event => {
const tokens = ...;
const payload = ...;
return admin.messaging().sendToDevice(tokens, payload);
})