I have an application that uses Google FCM for sending push notifications.
When i send a push notification to a group of users, i get a response of MismatchSen
Updating firebase initialization works for me..
<script src="https://www.gstatic.com/firebasejs/4.6.2/firebase.js"></script>
<script>
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
firebase.initializeApp(config);
</script>
Just an FYI. I was running into this error, even though I swear the android app I was testing was built with the latest/greatest google-services.json file and I could send from the FCM console to the app.
I rebuilt the app after doing a Clean Project
and now I can send to the app with the FCM token it registers. So, maybe try a clean rebuild before beating your head against the wall for too long.
My problem was solved by entering the correct key as shown below.
Copy Server key like this picture
And then copy this code in post man like this picture
and Body is row like this picture
NOTE:
For me the problem was that I was using the phonegap-plugin-push
in cordova, testing the app with the phonegap app.
The problem with this is that for some reason with this plugin, the phonegap app intercepts it and returns a dummy registration key, no matter what sender ID you have.
So to make it work (as long as you have all your keys right) is to test your program some other way, with an emulator, or android emulation via usb. And your keys will match.
Hopefully this saves someone some time.
I also getting the same error. i have copied the api_key and change into google_services.json. after that it workig for me
"api_key": [
{
"current_key": "********************"
}
],
try this
In my case it was very simple. I was pulling the wrong registrationId from the database. After I pulled the correct Id, it worked.