GCM 错误=MissingRegistration 通过 JSON 发送消息 [英] GCM Error=MissingRegistration sending messages via JSON
本文介绍了GCM 错误=MissingRegistration 通过 JSON 发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在通过 Fiddler 测试推送 GCM
标题:
用户代理:Fiddler授权:key=AIzaSyAkXfcuLLCZ-5n18wwO6XeJ13g-z9ja主机:android.googleapis.com内容长度:286
身体:
<代码> { registration_ids":[ APA91bHyn8YHcH_vSuOo7_A0PMgF5SU1K0FebOFGKXYTqpN5x4eD0tVBvzQLn749TVcczN5gSjB1wqf5AzYfxFI_qskA1Nzipf-9MfdEom1PI1vkFqKIg9B8vZvPLOLozE7jaRzELuyDzpFRbO3Xh5lT-KDA"], collapse_key的": 8b990f5a-78fc-4bad-B242-ffc740a750fb", 数据":{ 消息":消息发送到设备"}}
我有一个错误
Error=MissingRegistration
我的问题在哪里?所有 ID 都正确.
解决方案
您可能忘记在标头中指定内容类型为 JSON.
Content-Type: application/json
<块引用>
如果省略 Content-Type,则假定格式为纯文本.
对于纯文本,注册 ID 在名为 registration_id
而不是 registration_ids
的参数中传递,这解释了您的 MissingRegistration
错误.>
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.
解决方案
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.
这篇关于GCM 错误=MissingRegistration 通过 JSON 发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文