且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Firebase FCM MismatchSenderID

更新时间:2023-11-22 16:38:40

So to start of, I'd point out the description for MismatchSenderId error:

A registration token is tied to a certain group of senders. When a client app registers for FCM, it must specify which senders are allowed to send messages. You should use one of those sender IDs when sending messages to the client app. If you switch to a different sender, the existing registration tokens won't work.

As per our discussion, it was pointed out that you created a new Firebase Project instead of importing your Google Project that you were using for GCM. From the new project, the google-services.json was generated and used for the app, which resulted for new tokens to be associated with the new Project's Sender ID. To visualize it properly:

  • GCM Registration Tokens > only receive messages from > Google Project (1st)

  • New Tokens > only receive messages from > Firebase Project (2nd)

As a solution, I advised for you to import the Google Project to the Firebase Console, generate a google-services.json from that Project and replace the one in your app with that, which associates the app to that (correct) project. This in turn created tokens that are now associated with your 1st Project.

  • GCM Registration Tokens > only receive messages > Google Project (1st)

  • New Tokens > now receive messages > Firebase Project (2nd) Imported Google Project (1st)

Hope that makes sense.


Good to mention from the discussion:

  • After applying the changes, you mentioned that the error persisted, but it was a different issue that was fixed by simply using the Server Key.

  • Linked a post during discussion.