I have successfully integrated firebase on my mobile application. for now I am testing it on android. I am successfully receiving notification. My next step is to trigger the event when app is in foreground and in background and read the data. for this matter I saw the documentation and used firebase.notifications().displayNotification()
. But it is throwing error.
Ensure you have:
1) Installed the required Firebase Android SDK dependency 'com.google.firebase:firebase-notifications' in your 'android/app/build.gradle' file.
2) Imported the 'io.invertase.firebase.notifications.RNFirebaseNotificationsPackage' module in your 'MainApplication.java' file. 3) Added the 'new RNFirebaseNotificationsPackage()' line inside of the RN'getPackages()' method list.
It sounds like you need follow the instructions on this page to install the Notifications dependency. They recently rewrote the notifications part of react-native-firebase, so this might also be needed for your use case.