1
votes

GCM Notifications for the android app were perfectly working until the Server's which was used to send notification domain expired.

Upon domain renewal gcm notifications are not working. If I use current API Key, it gives

401 Unauthoried Acccess

On Generating new API key and new GCM id it gives below error

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

How can I fix this problem?

1
Is the new generated API key a "server key"? - Arthur Thompson
@ArthurThompson, Yes. - Dhaval Desai
The error MismatchSenderId usually indicates that the token you are sending to was not generated for the project that the API key belongs to. Is your new API key part of the same project as the previous one? - Arthur Thompson
@ArthurThompson, Yes, it is the same project, only the key is newly generated. Previously though it was Android Key, which worked from server. Now I have generated Server key which gives MisMatchSenderId. Android Key gives 401 Unauthorized Access error. - Dhaval Desai

1 Answers

3
votes

Based on Official Google Cloud Messaging documentation, a registration token is tied to a certain group of senders. When a client app registers for GCM, 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.

Double check the Sender ID and API_KEY, they must match or else you will get that MismatchSenderId error. See the Stack Overflow post: Why do I get MismatchSenderId from GCM server side?. And for the 401 Unauthorized Acccess error means that your API key is not valid. The issue is only for the method of generating a notification key on Android devices using a Google auth token.