【发布时间】:2019-07-13 22:47:33
【问题描述】:
我正在通过 google FCM 从服务器向客户端发送推送通知。
在 react-native 应用中我注册了这些监听器:
this.notificationOpenedListener = firebase.notifications().onNotificationOpened(async (notificationOpen) => {
})
this.notificationListener = firebase.notifications().onNotification(async (notification) => {
});
notification 数据包含在收到通知时是否应该发出声音/振动的信息。
但是,我找不到任何关于按需完全禁用声音/振动的文档。
我怎样才能做到这一点?
更新
我尝试在服务器端将声音设置为空字符串,但通知中仍有声音/振动。
var message = {
data: {
userId: fromUserId,
},
notification: {
title: `My notifcation`,
body: `Body`,
sound: "",
},
}
return sendToTopic(topicId, message)
【问题讨论】:
标签: firebase react-native push-notification firebase-cloud-messaging react-native-firebase