你好,
我正在尝试使用来自 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 来自这里:
我的 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/