Firebase in app messaging is not working in my react native project. Anyone having the same issue?

866 Views Asked by At

I'm getting push notification messages without any problem, but I'm having trouble with the in app message, my firebase versions are as followsenter image description here I did all the installations according to the documentation.But I don't know why it's not working react native version 0.64.4

I tried to install the latest version of firebase but it still didn't work

package.json

 "@react-native-firebase/analytics": "14.0.0",
    "@react-native-firebase/app": "14.0.0",
    "@react-native-firebase/crashlytics": "14.0.0",
    "@react-native-firebase/in-app-messaging": "14.0.0",
    "@react-native-firebase/messaging": "14.0.0"
inside my app js file the code is like this
async()=> {
    async function bootstrap() {
      await firebase.inAppMessaging().setMessagesDisplaySuppressed(true);
    }
    
    async function onSetup(user) {
      await setupUser(user);
      firebase.inAppMessaging().setMessagesDisplaySuppressed(false);
    }
    
    await bootstrap();
    await onSetup();    
  }

2

There are 2 best solutions below

5
Kirill Novikov On

Probably you need to use this package https://github.com/invertase/react-native-firebase/tree/main/packages/in-app-messaging

An example of usage is here:

https://rnfirebase.io/in-app-messaging/usage#main

Also please use version ^16 of libraries for Firebase

2
Ammar Khan On

I had the same issue just follow the instruction as following

  1. Go to google console and select the project that you created at firbase console and just search for in-app messaging API enable the api for your project. Here is the link https://console.cloud.google.com/

Hope you this will fix your issue.

Enjoy!!