Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 730
gilp Avatar asked Jul 03 '12 09:07

gilp


People also ask

What is difference between GCM and FCM?

FCM is a cloud platform that provides messages and push notifications for operating systems- ios and Android, and websites as well. Google Cloud Messaging is a messaging service that enables the message transfer from server to clients apps.

What is GCM notification?

Google Cloud Messaging (GCM) was a mobile notification service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications that target the Google Android Operating System, as well as applications or extensions developed for the ...

What is sender ID Firebase?

Sender ID. A unique numerical value created when you create your Firebase project, available in the Cloud Messaging tab of the Firebase console Settings pane. The sender ID is used to identify each sender that can send messages to the client app.


2 Answers

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.

like image 70
Atul Bhardwaj Avatar answered Sep 28 '22 06:09

Atul Bhardwaj


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.

like image 41
Redth Avatar answered Sep 28 '22 05:09

Redth