简体   繁体   English

如何在 React Native 中接收来自 Firebase 云消息传递的通知

[英]How to receive notifications from Firebase Cloud Messaging in React Native

I have a react native project and want to be able to receive notification from FCM.我有一个反应原生项目,希望能够接收来自 FCM 的通知。 I have set up the project ( generated a google-services.json file for my project, modified the build.gradle files accordingly etc ) but so far I haven't been able to run the project.我已经设置了项目(为我的项目生成了一个 google-services.json 文件,相应地修改了 build.gradle 文件等),但到目前为止我还无法运行该项目。 I am using React Native Firebase library https://rnfirebase.io/ but the experience is just not good so far.我正在使用 React Native Firebase 库https://rnfirebase.io/但到目前为止体验并不好。 I've been stumbling from error to error like the one below:我一直在错误地跌跌撞撞,如下所示:

Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app().

Ensure you have:

1) imported the 'io.invertase.firebase.app.ReactNativeFirebaseAppPackage' module in your 'MainApplication.java' file. 
2) Added the 'new ReactNativeFirebaseAppPackage()' line inside of the RN 'getPackages()' method list.

I'm just done trying to get the tooling to work.我刚刚完成了让工具正常工作的尝试。 Can you tell me what other approach I can take to get firebase notifications to work for a React Native project that doesn't make use of the library above?你能告诉我还有什么其他方法可以让 firebase 通知适用于不使用上述库的 React Native 项目吗?

Have you followed the suggestions in the error message?您是否按照错误消息中的建议进行操作? Also what could work is deleting the build and cache of your android project, and then rebuilding the application.还可以删除 android 项目的构建和缓存,然后重建应用程序。 What version of firebase you are using?您使用的是什么版本的 firebase?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React-Native-Firebase Cloud Messaging-如果从任务栏打开则没有事件 - React-Native - Firebase Cloud Messaging - no Event if open from Tray Firebase Cloud Messaging Android接收静默推送通知 - Firebase Cloud Messaging Android receive silent push notifications Firebase云消息传递服务 - 即使应用程序被终止也会收到通知 - Firebase Cloud Messaging Service - Receive Notifications even when app is killed 没有收到Firebase Cloud Messaging通知 - Not receiving Firebase Cloud Messaging Notifications Flutter 通知与 Firebase 云消息传递 - Flutter Notifications with Firebase Cloud Messaging Firebase消息传递-无法接收来自订阅的通知 - Firebase Messaging - Can't receive notifications from subscriptions 如何使用Firebase Cloud Messaging根据Firebase数据发送通知 - How to send notifications depending on the Firebase data using Firebase Cloud Messaging 应用程序未运行时如何堆叠 Firebase Cloud Messaging 通知? - How to stack Firebase Cloud Messaging notifications when the application is not running? 如何使用 Firebase 云消息发送组通知? - How to send the Group Notifications using Firebase Cloud messaging? 如何使用AppEngine Python通过Firebase Cloud Messaging将通知发送到Android应用程序 - How to send Notifications to Android App with Firebase Cloud Messaging with AppEngine Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM