When sending messages using GCM, I keep getting the response 'MismatchSenderId' [duplicate]
I'm implementing a push notification server with GCM. I send a post request with a sender ID (application key) that I got from Google API Console, and a registration ID that I got from the GCM service.
The posted JSON includes one registration ID. I always get the same response:
{
"multicast_id":8546528660791862014,
"success":0,
"failure":1,
"canonical_ids":0,
"results":[
{
"error":"MismatchSenderId"
}
]
}
What might be the problem? What am I doing wrong?
Please uninstall your Android app from the device and run the app again.
Now you will get a new registration Id. That may solve your MismatchSenderId problem in a specific case (Sometimes it happens If you change/refresh your API key, but still using the old registration key). In my case, I got the registration Id first for my device and then I changed my API Key (on Google GCM server) and then I got MismatchSenderId error. Finally, I uninstalled my Android app from the device and the problem got solved.
See the Stack Overflow post Why do I get "MismatchSenderId" from GCM server side?.
From the URL above:
double check the Sender ID and API_KEY, they must match or else you will get that MismatchSenderId error. In the Google API Console, look at the URL of your project:
https://code.google.com/apis/console/#project:xxxxxxxxxxx
The xxxxxxxxx is the project ID, which is the sender ID.
Some people are reporting issues using the "Key for Server Apps" type of keys, but having success using the Browser Key type instead. Personally, the Server Key type works for me, but try both, YMMV.