I think that the gcm behaviour regarding custom fields goes against the normal GCM workings as specified at the GCM API reference (https://developers.google.com/cloud-messaging/http-server-ref).
The fact that all custom fields are wrapped in a map that is mapped under the 'data' key in the GoogleCloudMessagingPusher is, I feel, a violation of the data custom fields rules as described in the GCM API reference.
(Promtius logic = https://github.com/appfoundry/Promtius/blob/master/promtius-gcm/src/main/java/be/appfoundry/promtius/google/GoogleCloudMessagingPusher.java#L68)
This goes together with the custom added logic to the Message object.
The addData method in the Message object, as found at
https://github.com/appfoundry/Promtius/blob/master/promtius-gcm/src/main/java/be/appfoundry/custom/google/android/gcm/server/Message.java#L125
should be in the form of:
public Builder addData(Map<String, ?> customFields) {
data.putAll(customFields);
return this;
}
which I feel would have been the more correct behaviour with regards to using the GCM api.
This way Promtius would send simple key-value pairs that, when delivered at an Android device through Google Play Services, would be delivered as the expected, simple, intent extra's.
This would mean that Promtius is sending GCM messages in a way that violates the spec.
Secondly, Promtius does not restrict the data types of the custom fields... Would it not be better if Promtius either 1) had platform-specific custom fields declarations or 2) typed the custom fields definition to the lowest common denominator, which with the current implementations would mean that custom fields should be typed to a Map<String, String> ?
I think that the gcm behaviour regarding custom fields goes against the normal GCM workings as specified at the GCM API reference (https://developers.google.com/cloud-messaging/http-server-ref).
The fact that all custom fields are wrapped in a map that is mapped under the 'data' key in the GoogleCloudMessagingPusher is, I feel, a violation of the data custom fields rules as described in the GCM API reference.
(Promtius logic = https://github.com/appfoundry/Promtius/blob/master/promtius-gcm/src/main/java/be/appfoundry/promtius/google/GoogleCloudMessagingPusher.java#L68)
This goes together with the custom added logic to the Message object.
The addData method in the Message object, as found at
https://github.com/appfoundry/Promtius/blob/master/promtius-gcm/src/main/java/be/appfoundry/custom/google/android/gcm/server/Message.java#L125
should be in the form of:
which I feel would have been the more correct behaviour with regards to using the GCM api.
This way Promtius would send simple key-value pairs that, when delivered at an Android device through Google Play Services, would be delivered as the expected, simple, intent extra's.
This would mean that Promtius is sending GCM messages in a way that violates the spec.
Secondly, Promtius does not restrict the data types of the custom fields... Would it not be better if Promtius either 1) had platform-specific custom fields declarations or 2) typed the custom fields definition to the lowest common denominator, which with the current implementations would mean that custom fields should be typed to a
Map<String, String>?