首页 > 解决方案 > 在 React Native 上使用 ConnectyCube 推送通知

问题描述

我正在尝试在 React Native 上使用 ConnectyCube 使用推送通知。主要问题是,如果我从 ConnectyCube 的管理面板(或源代码)发送通知,管理面板会说通知已成功传递,但 android 模拟器上没有任何反应。也许有人会认为我的 onMessageListener 的实现在客户端存在一些错误:

notificationListener = firebase.notifications().onNotification((notification) => {
    console.log("Hi!")
});

无论如何,如果我尝试通过 Firebase 控制台发送通知,一切正常,我会收到通知。你能帮助我吗?

标签: react-nativepush-notificationconnectycube

解决方案


您似乎使用了错误的方法:https ://rnfirebase.io/docs/v5.xx/notifications/introduction

React Native Firebase 通知模块处理仅通知和通知 + 数据 FCM 远程消息。

对于纯数据 FCM 消息,请参阅消息模块。

ConnectyCube 发送一条数据推送消息。因此,请尝试根据本指南使用消息模块: https ://rnfirebase.io/docs/v5.xx/messaging/receiving-messages


推荐阅读