GCM Error=MissingRegistration sending messages via JSON
For Firebase, You can get info from https://firebase.google.com/docs/cloud-messaging/http-server-ref#error-codes
Check that the request contains a registration token (in the registration_id in a plain text message, or in the to or registration_ids field in JSON).
For the new cloud Message, when you want to send a dwonstream message from the server, you need to use "to" to declaim the target registration id.
like below :
https://gcm-http.googleapis.com/gcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx..."
}
You probably forgot to specify the content type in the header to be JSON.
Content-Type: application/json
If Content-Type is omitted, the format is assumed to be plain text.
And for plain text the registration ID is passed in a parameter called registration_id
instead of registration_ids
, which explains your MissingRegistration
error.