narkis narkis - 23 days ago 8
Android Question

gcmsender error: MismatchSenderId

I am testing the updated google gsm cloud services with their sample app
https://github.com/googlesamples/google-services/tree/master/android/gcm
and I am following google tutorial here:
https://developers.google.com/cloud-messaging/android/start

the device client is set up, I am receiving the token and I already have the google-services.json downloaded and configured on the my developer console.

I understand that the API key is used by the gcmsender module to send a test message, however I receive an error:
"results":[{"error":"MismatchSenderId"}]}
I have confirmed that the google-services.json is using the same sender id as was supplied to me by the developer console.
What am I missing?

Answer

Please run below script in your terminal

curl -X POST \
-H "Authorization: key= write here api_key" \
-H "Content-Type: application/json" \
-d '{
"registration_ids": [ "write here reg_id generated by gcm"], "data": { "message": "Manual push notification from Rajkumar" }, "priority": "high"
}' \ https://android.googleapis.com/gcm/send

MismatchSenderId because with in same device you have logged with different keys. to solve this problem uninstall app and run it againg and update the registration key. and then run the CURL script in your teminal which i post above it will give success message and you will get notification to your device