MismatchSenderID error in firebase API

2019-03-04 10:01发布

I'm writing server-side code for android notification using FCM.

So the code sends the notification correctly to the topics but not to the particular device's registration token. So the code works fine for this case-

info.put("to", "topics/xyz"); 
info.put("title", "Hello 1");
info.put("body", "Hi");

But for the second case-

info.put("to", DeviceIdKey.trim()); //device registration token
info.put("title", "Hello 1");
info.put("body", "Hi");

it gives,

OUTPUT:

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

IMPORTANT - And the registration tokens for all the android/IOS devices which I have are 2 years old generated by GCM. Thanks!

1条回答
爷、活的狠高调
2楼-- · 2019-03-04 10:28

MismatchSenderId error occurs if your target token is not associated to the project that is sending the message (as I mentioned in my answers here and here). It does not mean that the token is expired, if it were, you would receive a NotRegistered error instead.

In general, GCM tokens should still be compatible with FCM (see my answer here), they could still receive the message, provided that the sender is associated with the token (if you simply import your project to Firebase Console, then it should be fine).

查看更多
登录 后发表回答