react-native - 在 React Native 上使用 ConnectyCube 推送通知
问题描述
我正在尝试在 React Native 上使用 ConnectyCube 使用推送通知。主要问题是,如果我从 ConnectyCube 的管理面板(或源代码)发送通知,管理面板会说通知已成功传递,但 android 模拟器上没有任何反应。也许有人会认为我的 onMessageListener 的实现在客户端存在一些错误:
notificationListener = firebase.notifications().onNotification((notification) => {
console.log("Hi!")
});
无论如何,如果我尝试通过 Firebase 控制台发送通知,一切正常,我会收到通知。你能帮助我吗?
解决方案
您似乎使用了错误的方法:https ://rnfirebase.io/docs/v5.xx/notifications/introduction
React Native Firebase 通知模块处理仅通知和通知 + 数据 FCM 远程消息。
对于纯数据 FCM 消息,请参阅消息模块。
ConnectyCube 发送一条数据推送消息。因此,请尝试根据本指南使用消息模块: https ://rnfirebase.io/docs/v5.xx/messaging/receiving-messages
推荐阅读
- java - 如何通过 JPQL 从 SQL 计数返回布尔结果
- html - 在非全宽元素中设置全宽动态元素样式的最佳方法是什么?
- dart - Flutter:无法使用任何包获取位置 - 尝试了各种包 - getLocation 块
- php - 如何在 PHP 中使用存储在数据库中 SQL 查询中的变量
- deep-learning - RNN 如何从图像中提取特征
- android - React Native:悬停图像 onPress
- javascript - getorgchart - 我想动态分配颜色
- function - 接受一个参数的函数的值,该参数本身就是一个函数
- docker - nsenter 错误:_nl_intern_locale_data:断言失败
- javascript - 饼图 - 使用 DataTables 和 Highcharts 进行数据可视化