Tuesday, April 23, 2013

Android PUSH: GCM error: Missing registration_ids field

Hello,                                                                        

When trying to send the registration_id in the format requested in the site I got the error: 'Missing registration_ids field'. Sending it as an array worked as shown below.

Initial: 
Content-Type:application/json
Authorization:key=AIzaSyB-1uEai2WiUapxCs2...

{
  "registration_id" : "APA91bHun4MxP5egoKMwt2KZF....",
  "data" : {
    "Team" : "Portugal",
    "Score" : "3",
    "Player" : "Varela",
  },
}
Gives the following error: Missing "registration_ids" field

Use:                                                                            {
  "registration_ids" : ["APA91bGSnrAvxspEngNfGqd4JDsl00..."],
  "data" : {
    "Team" : "Portugal",
    "Score" : "3",
    "Player" : "Varela",
  },
}

Hope this helps !

No comments:

Post a Comment