FCM getting MismatchSenderId

前端 未结 29 1890
刺人心
刺人心 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:47

    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>
    
    0 讨论(0)
  • 2020-12-04 17:48

    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.

    0 讨论(0)
  • 2020-12-04 17:48

    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:

    • You must add key= before Server key in header
    • Make sure you enter the header keys correctly (Authorization = "key=..." and ContentType = "application/json")
    • You have sent the request to the correct address (https://fcm.googleapis.com/fcm/send and Post method)
    0 讨论(0)
  • 2020-12-04 17:48

    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.

    0 讨论(0)
  • 2020-12-04 17:49

    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

    0 讨论(0)
  • 2020-12-04 17:50

    In my case it was very simple. I was pulling the wrong registrationId from the database. After I pulled the correct Id, it worked.

    0 讨论(0)
提交回复
热议问题