In the android GCM document, it is said the payload has a limit of 4096 bytes.
However, I found that I can send a payload with 16834 byes.
Did I make a mistake? I computed the length as follows:
Map<Object, Object> jsonRequest = new HashMap<Object, Object>();
setJsonField(jsonRequest, GCMConstants.PARAM_TIME_TO_LIVE, message.getTimeToLive());
setJsonField(jsonRequest, GCMConstants.PARAM_COLLAPSE_KEY, message.getCollapseKey());
setJsonField(jsonRequest, GCMConstants.PARAM_DELAY_WHILE_IDLE, message.isDelayWhileIdle());
jsonRequest.put(GCMConstants.JSON_REGISTRATION_IDS, registrationIds);
Map<String, Object> payload = message.getData();
if (!payload.isEmpty()) {
jsonRequest.put(GCMConstants.JSON_PAYLOAD, payload);
}
String requestBody = gson.toJson(jsonRequest);
System.out.println(requestBody.getBytes("UTF-8").length);
Furthermore, what's the response from GCM if the payload is too long?