Firebase FCM MismatchSenderID [英] Firebase FCM MismatchSenderID

查看:1775
本文介绍了Firebase FCM MismatchSenderID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Android客户端应用程序安装在多个设备上。
我也有我的服务器应用程序发送消息到这些应用程序。
问题是有些设备接收到消息而其他设备没有。
当发送消息到这些设备时,我得到错误 MismatchSenderId



我把问题分开了,所以我打开firebase控制台并发送通知给我的应用程序(我有他们每个人的令牌)。所以,使用控制台应用程序,我在使用我的服务器相同的设备上出现错误。但正如我所说,每个设备都使用相同的应用程序。



任何帮助原因? 所以要开始,我会指出 MismatchSenderId 错误:
$ b


注册令牌绑定到一组发件人。当客户端应用程序注册FCM时,它必须指定允许哪些发件人发送消息。发送消息到客户端应用程序时,您应该使用其中一个发件人ID。如果您切换到另一个发件人,现有的注册令牌将不起作用。

根据我们的讨论,有人指出您创建了一个新的Firebase项目,而不是导入您用于GCM的Google项目。从新项目中,生成了google-services.json,并将其用于应用程序,这导致新的标记与新项目的发件人ID 。要正确显示它:




  • GCM注册令牌只接收来自Google Project(1st)的消息

    li>
  • 新代币>仅接收来自Firebase Project(2nd)的消息



<作为解决方案,我建议您将Google项目导入到Firebase控制台,从该项目生成一个google-services.json,并将应用程序替换为该应用程序与该项目关联的项目。这反过来创建了现在与您的第一个项目相关联的令牌。


  • GCM注册令牌只接收消息> Google Project 1)现在接收消息> Firebase Project(2nd)导入Google项目(1st)

    / li>


希望是有道理的。




从讨论中可以很好地提出:


  • 应用这些更改之后,您提到错误持续存在,但是一个简单地使用服务器密钥修复的另一个问题。


  • 链接


I have my client app with Android installed in several devices. I also have my Server app that send messages to those apps. The problem is that some devices receive the messages and other don't. I get the error "MismatchSenderId" when sending the message to those devices.

I divided the problem, so I open the firebase console and send notifications to my apps (I have the Token for each of them). So, using the console app, I get errors on the same devices that using my server. But as I said, every device is using the same app.

Any help of the reason?

解决方案

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.

这篇关于Firebase FCM MismatchSenderID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆