AJDee
AJDee

Reputation: 147

Issue - My React Native App showing FirebaseError: Messaging

I am currently receiving the below error when attempting to use firebase cloud messaging in my react native app by calling firebase.messaging():

FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).

I am not too sure why I am getting the browser error as I am trying to use iOS push notification not web notification. I am not sure if I have setup firebase cloud messaging in my firebase console or if I need to. I have had a look at a few links but they haven't been helpful.

I am using a real iOS device when attempting to message on my app.

Below is my firebase config:

import firebase from '@react-native-firebase/app';


const firebaseConfig = {
  apiKey: "AIzaSyCjWwL5rs6n-lTlqAkaEh5eK**********",
  authDomain: "appname***-36a**.firebaseapp.com",
  databaseURL: "https://appname***-36a**.firebaseio.com",
  projectId: "appname***-36a**",
  storageBucket: "appname***-36a**.appspot.com",
  messagingSenderId: "898189283****",
  appId: "1:898189283761:web:9e09a6566fcb0629d*****",
  measurementId: "G-VYF6PH0M**"
};



export default firebase;

I would like to eventually get the FCM registration token. Can someone please assist? I am using bare react native.

Upvotes: 0

Views: 706

Answers (1)

Hamas Hassan
Hamas Hassan

Reputation: 941

You have to use messaging from this library.

"@react-native-firebase/messaging"

import messaging from '@react-native-firebase/messaging';

For more reference here is the official doc https://rnfirebase.io/messaging/usage

Upvotes: 1

Related Questions