【发布时间】:2020-04-10 09:31:00
【问题描述】:
我在与 Firebase 实时数据库相关的 Google Cloud Platform 中创建了这个函数。当数据库中出现某些内容时,该函数会向移动应用程序发送通知。
如下所示,我设置了优先级,以便用户注意到通知
var message = {
token: tokenSnapshot,
notification: {
title: "Title",
body: "Body",
},
android: {
priority: 'high',
notification: {
sound: 'default',
priority: 'high',
visibility: 'public'
}
},
};
不幸的是,它什么也没做。通知来了,但用户在手动检查是否有东西时会看到
我在应用程序中使用标准方法
messaging().enable.setBackgroundMessageHandler(async remoteMessage => {
console.log('Message handled in the background!', JSON.stringify(remoteMessage));
})
有什么方法可以让通知带有声音、振动并出现在锁定屏幕上?
我还没有使用过react-native-push-notification 库。这个库可以在这方面提供帮助吗?
【问题讨论】:
标签: firebase react-native push-notification firebase-cloud-messaging