我正在使用Google云消息传递向多个设备发送推送通知。以下是我发送的JSON数据:
{"to":["APA91bHMvoTuEYQAGwgB7Q-Em8j4DyZOrGXZJ9uTyFhddojDFHr0VeZUHAEgw_kk6QFmKQoWe6oN2fIgDAw9AoPigCqZ4BaMlNzxqWoBRx6Q3ZBBKTinzqUj8F7BEA5ZHmCIArsEB3zT","APA91bE4mP2TscsMf4IJT9-o70YSFPMo34NGGG4IXS4Oe9uuHawxTGplqd017NiGXC5ftlIUaXIIkI60nR7w5GI1UPy5IdqYDPt0_C1TW5S5o1zaGKfv9CKtb6CV3cDc1cvEKyCeMwUe3NZpX4UmhIGJfEmetQUNgg","APA91bHwfnK5l6CbHe_2SddBSHPJmuOxI0AapbyXAbuMVktFIICJx6WTu44ElkuxoBd70rsmdrdGSV7r9hDFvW-cBynunqOJAhI8PhKjDd2hINU91vP4_6yWRtRN2PYCXwkhkKxORrPcMi7pezt8FGhmynznIJpW9A"],"delay_while_idle":true,"collapse_key":"sample","delivery_receipt_requested":true,"data":{"message":"Stuffed Aloo Curry with Gatta Pulao by Chef Shelly","title":"Today's Special","request_type":"promotion"},"message_id":"m-313e76a8-b42c-4a8c-a1d4-ad58a059494a","time_to_live":10000}
我无法发送推送消息,我收到的信息低于消息
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></success>
<iq id='e0nLC-0' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>170453453515@gcm.googleapis.com/SmackAA9F4121</jid></bind></iq>
<iq id='e0nLC-1' type='result'></iq>
<message><gcm xmlns="google:mobile:data">{"message_id":"m-313e76a8-b42c-4a8c-a1d4-ad58a059494a","from":"","error_description":"InvalidJson: MISSING_REGISTRATIONS : Missing \"to\" field\nJSON_TYPE_ERROR : Field \"to\" must be a JSON java.lang.String: [\"APA91bHMvoTuEYQAGwgB7Q-Em8j4DyZOrGXZJ9uTyFhddojDFHr0VeZUHAEgw_kk6QFmKQoWe6oN2fIgDAw9AoPigCqZ4BaMlNzxqWoBRx6Q3ZBBKTinzqUj8F7BEA5ZHmCIArsEB3zT\",\"APA91bE4mP2TscsMf4IJT9-o70YSFPMo34NGGG4IXS4Oe9uuHawxTGplqd017NiGXC5ftlIUaXIIkI60nR7w5GI1UPy5IdqYDPt0_C1TW5S5o1zaGKfv9CKtb6CV3cDc1cvEKyCeMwUe3NZpX4UmhIGJfEmetQUNgg\",\"APA91bHwfnK5l6CbHe_2SddBSHPJmuOxI0AapbyXAbuMVktFIICJx6WTu44ElkuxoBd70rsmdrdGSV7r9hDFvW-cBynunqOJAhI8PhKjDd2hINU91vP4_6yWRtRN2PYCXwkhkKxORrPcMi7pezt8FGhmynznIJpW9A\"]","error":"INVALID_JSON","message_type":"nack"}</gcm></message>
如果我使用单个gcmId作为String发送推送,它可以正常工作。但是,如果我将它发送到gcmId列表,我会得到错误响应:
“MISSING_REGISTRATIONS:Missing”到\“field \ nJSON_TYPE_ERROR:Field \”到\“必须是JSON java.lang.String”