【发布时间】:2018-08-05 12:32:07
【问题描述】:
每当数据库写入时,我都会尝试向我的应用的所有用户发送通知。
这是我目前的代码。
export const newUserAdded = functions.database
.ref('1_0_0/updateDate/date')
.onWrite((event)=>{
//send notfigication to all
admin.messaging().sendToCondition()
})
正如您所见,只要有写入 date 键,该函数就会触发。
但请注意,我没有用户的设备令牌,因为我想向所有用户发送通知。我找不到任何方法这样做。
请告诉我如何实现这一目标。
谢谢
【问题讨论】:
标签: firebase firebase-cloud-messaging google-cloud-functions