Reputation: 988
I've got following method in my CCS Server.
public static String createJsonMessage(JsonArray to, String messageId,
Map<String, String> payload, String collapseKey, Long timeToLive,
Boolean delayWhileIdle) {
Map<String, Object> message = new HashMap<String, Object>();
message.put("to", to);
if (collapseKey != null) {
message.put("collapse_key", collapseKey);
}
if (timeToLive != null) {
message.put("time_to_live", timeToLive);
}
if (delayWhileIdle != null && delayWhileIdle) {
message.put("delay_while_idle", true);
}
message.put("message_id", messageId);
message.put("data", payload);
return JSONValue.toJSONString(message);
}
Now, when I try to send a GCM message with this function (trying to send multiple message in one request. So I have a JsonArray like this (gcm json message):
<message id="lT2FX-2"><gcm xmlns="google:mobile:data">{"to":["APA91bGnOTbGWmIW6Bjq_derdLpLbdYo90eLdls7miIrBXSWPyKlWU7y_Dnp2y1AE41bdkQYo70egwi-QnRDzGPxeABvygLmiukLN5ZfcxfXq-D8ekDb1KaiJOsHHPH1bq5HOq9K4wWUDVYmWzAtMwfWUR5YEUUKDw","APA91bHTe_PMWa3xsqIlYebmNCeVaF7FbqtZ-QC4WxKltMnyDFIBakjr8TfWrL2cQr47XWxev4f13Mdjk-5LVTiFZ13hv1duGhib00skO2zmCoyAKQGETI7ECB6suMG9lFyAUW6_PfUiCS4eOvlshscdF6ztu80pkw","APA91bHj5cWhbnGmQ5h20Hx93JQeo5ejq3iJcY_fBNwxhPnSkvgRYRNbFzSzSgwXJDBDcb97CgvDfQukYAuFpCWj1-4d7CGWiD7sGkXyNheQuKhVbuTFKg32VdJNazrCT7-XX7GAOYxhEe-E9U-XoZmQ6N6FNua4wg"],"collapse_key":"newGreenStatus","data": ...
This is not working, but when I switch back to a single registration id (something like this:
<message id="cXEMp-2"><gcm xmlns="google:mobile:data">{"to":"APA91bHj5cWhbnGmQ5h20Hx93JQeo5ejq3iJcY_fBNwxhPnSkvgRYRNbFzSzSgwXJDBDcb97CgvDfQukYAuFpCWj1-4d7CGWiD7sGkXyNheQuKhVbuTFKg32VdJNazrCT7-XX7GAOYxhEe-E9U-XoZmQ6N6FNua4wg","collapse_key":"newGreenStatus","data":
then it's working again.
I also tried changing "to" to "registration_ids" and still no changes. (Of course the parameter in createJsonMessage
is changed back to String.)
What am I doing wrong here?
Upvotes: 0
Views: 240
Reputation: 988
Found the answer to the problem here: https://developer.android.com/google/gcm/server.html
In CCS
CCS does not support multicast messaging.
So, it is not possible...
Upvotes: 1