android - FCM 推送通知 : MismatchSenderId

标签 android firebase push-notification google-cloud-messaging firebase-cloud-messaging

你好,

我正在尝试使用来自 FCM 的这个 URL 来发送消息:

https://fcm.googleapis.com/fcm/send

标题为

    Authorization value of **key:*Key from Firebase Console***
    Content-Type: **application/json**

正文由以下部分组成:

    {
       "to" : "MyKey generated",
       "notification" : {
       "body" : "Hey",
       "title" : "Hey"
    }  
 }

但我总是收到这样的结果:

     {
        "multicast_id": 7942550122547405787,
        "success": 0,
        "failure": 1,
        "canonical_ids": 0,
        "results": [
            {
               "error": "MismatchSenderId"
           }
      ]
    }

我得到的服务器 key 来自这里:

Server Key

我的 URL 引用是 FCM 服务器中的文档。

我正在 Postman 中对此进行测试。我错过了什么?谢谢

最佳答案

根据文档

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.

所以听起来您正在尝试向与发件人 ID 无关的 ID 发送推送通知。你应该验证你在正确的地方有正确的 key

关于android - FCM 推送通知 : MismatchSenderId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44928046/

相关文章:

Android AudioManager.setSpeakerphoneOn() 不会更改扬声器按钮状态

javascript - 从另一个云函数调用一个云函数

android - firebase 在 datasnapshot.haschild() 背后使用了哪种算法?

ios - Firebase-admin 不发送 iOS APN 通知

ios - Firebase 推送通知无法正常工作 ios11 swift 4.1

android - 命令调用失败 : : Unable to forward network traffic to device in Unity

java - Android 中的 Tensorflow : java. lang.illegalArgumentsException

android - 有没有办法覆盖锁定图案屏幕?

javascript - firebase-functions.js 调用 firebase.functions() 时出现内部错误

swift - didReceiveRemoteNotification 未调用 swift 3 iOS 10