我有同样的问题,因为这个.我会尝试提供更多信息.
我正在使用Play Framework,用Java编写.我写了一个名为PushNotificationQueue的插件.PushNotificationQueue运行iOS和Android推送消息队列.以下是我的GCM实施参考.
public class AndroidPushNotificationQueue {
// (constructors and fields not included for brevity)
// constructor starts a daemon thread
/**
* Sends a notification.
* @param notifyKeys - device tokens
* @param data - data to send
**/
public void sendNotification(List<String> notifyKeys, Map<String, String> data) {
if (notifyKeys.size() == 0) {
return;
}
Builder b = new Message.Builder();
if (data != null) {
for (String key : data.keySet()) {
b.addData(key, data.get(key));
}
}
if (testMode) { …Run Code Online (Sandbox Code Playgroud)