firebase.notifications()在react-native-firebase中引发错误

Sye*_*san 1 android firebase react-native-firebase

我已成功将Firebase集成到我的移动应用程序中。目前,我正在android上对其进行测试。我已成功收到通知。我的下一步是在应用程序处于前台和后台时触发事件并读取数据。为此,我看了文档并使用了firebase.notifications().displayNotification()。但这会引发错误。

确保您具有:

1)在“ android / app / build.gradle”文件中安装了必需的Firebase Android SDK依赖项“ com.google.firebase:firebase-notifications”。

2)在您的“ MainApplication.java”文件中导入了“ io.invertase.firebase.notifications.RNFirebaseNotificationsPackage”模块。3)在RN'getPackages()'方法列表内添加了'new RNFirebaseNotificationsPackage()'行。

Noa*_*len 7

听起来您需要按照此页面上的指示信息来安装Notifications依赖项。他们最近重写了react-native-firebase的通知部分,因此您的用例也可能需要这样做。