FCM getting MismatchSenderId

前端 未结 29 1967
刺人心
刺人心 2020-12-04 17:34

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

29条回答
  •  心在旅途
    2020-12-04 17:57

    I had the same issue in my react-native - node.js project. I wanted to send notifications in android. Everything was set-up and working fine (i.e. I was able to send notifications from node.js and receive notifications on android device).

    After a few days, I had to use a different firebase account, so I changed the google-services.json file in my project's android/app folder and rebuilt the project. But, when I tried sending notification from my server once again, I got an error -

    {.............
      errorInfo: {
        code: 'messaging/mismatched-credential',
        message: 'SenderId mismatch'
      },
      codePrefix: 'messaging'
    }
    

    Solution:

    the XML file at the location - app/build/generated/res/google-services/{build_type}/values/values.xml was not getting automatically updated according to new google-services.json. It still consisted of old values from my previous google-services.json file. I had to change values.xml file manually.

    This is how app/build/generated/res/google-services/{build_type}/values/values.xml file look (You need to change it manually if it does not get updated automatically according to google-services.json)-

    
    
    
        
        1:1035469437089:android:73a4fb8297b2cd4f
    
        
        1035469437089
        337894902146-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com
        UA-65557217-3
        https://example-url.firebaseio.com
        AIzbSyCILMsOuUKwN3qhtxrPq7FFemDJUAXTyZ8
        AIzbSyCILMsOuUKwN3qhtxrPq7FFemDJUAXTyZ8
        mydemoapp
    
     
    

    You can refer to these links:

    1. https://firebase.google.com/docs/projects/multiprojects
    2. Processing the JSON file: https://developers.google.com/android/guides/google-services-plugin#processing_the_json_file.

提交回复
热议问题