firebase - Firebase 通知中的权限
问题描述
我在与 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-cloud 消息传递,我建议在您的应用中使用 firebase。 https://rnfirebase.io/messaging/usage
确保首先遵循初始设置。
请在此处阅读有关此内容的更多信息。https://rnfirebase.io/
推荐阅读
- python - 如何编写包含 HTML 实体的 XPath 查询?
- python - 来自不同(测试)文件的一个代码数据与一个文件中的所有数据有何不同?
- python - 如何使用 Python 点击 Spotify Play 按钮
- regex - {First_name 和 First_name Last_name} 模式的正则表达式解决方案:
- html - 将hello world添加到cpanel
- c# - 在尺寸减小时防止图像尺寸增大
- java - 将 Java 对象传递给 Retrofit 无法正确处理
- batch-file - 在批处理文件中使用 WinSCP 从 SFTP 服务器获取具有最新日期的文件
- python-3.x - 我怎样才能让一个方法使用其他方法的变量?
- sql - 如何从相关数据库表中准备 JSON 对象和数组?