Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 views
in Technique[技术] by (71.8m points)

android - GCM Error=MissingRegistration sending messages via JSON

I'm testing push GCM via Fiddler

Headers:

User-Agent: Fiddler
Authorization: key=AIzaSyAkXfcuLLCZ-5n18wwO6XeJ13g-z9ja
Host: android.googleapis.com
Content-Length: 286

Body:

{"registration_ids":["APA91bHyn8YHcH_vSuOo7_A0PMgF5SU1K0FebOFGKXYTqpN5x4eD0tVBvzQLn749TVcczN5gSjB1wqf5AzYfxFI_qskA1Nzipf-9MfdEom1PI1vkFqKIg9B8vZvPLOLozE7jaRzELuyDzpFRbO3Xh5lT-KDA"],"collapse_key":"8b990f5a-78fc-4bad-b242-ffc740a750fb","data":{"message":"message to device"}}

I've got a error

Error=MissingRegistration

Where is my problem? All ids are correct.

question from:https://stackoverflow.com/questions/22486192/gcm-error-missingregistration-sending-messages-via-json

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...