You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/09/22 17:16:06 UTC
[20/25] usergrid git commit: fix time_to_live gcm
fix time_to_live gcm
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/549be61e
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/549be61e
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/549be61e
Branch: refs/heads/usergrid-1007-shiro-cache
Commit: 549be61e3b53656e09db4139b3f0376d8c2f4fdc
Parents: 48391ac
Author: Shawn Feldman <sf...@apache.org>
Authored: Sat Sep 19 15:01:06 2015 -0400
Committer: Shawn Feldman <sf...@apache.org>
Committed: Sat Sep 19 15:01:06 2015 -0400
----------------------------------------------------------------------
.../usergrid/services/notifications/gcm/GCMAdapter.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/549be61e/stack/services/src/main/java/org/apache/usergrid/services/notifications/gcm/GCMAdapter.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/gcm/GCMAdapter.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/gcm/GCMAdapter.java
index bdd7737..ba404e8 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/gcm/GCMAdapter.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/gcm/GCMAdapter.java
@@ -74,7 +74,7 @@ public class GCMAdapter implements ProviderAdapter {
long ttlSeconds = notification.getExpireTTLSeconds();
// max ttl for gcm is 4 weeks - https://developers.google.com/cloud-messaging/http-server-ref
ttlSeconds = ttlSeconds <= 2419200 ? ttlSeconds : 2419200;
- map.put(expiresKey, ttlSeconds);
+ map.put(expiresKey, (int)ttlSeconds);//needs to be int
}
Batch batch = getBatch( map);
batch.add(providerId, tracker);
@@ -204,8 +204,13 @@ public class GCMAdapter implements ProviderAdapter {
Sender sender = new Sender(notifier.getApiKey());
Message.Builder builder = new Message.Builder();
builder.setData(payload);
+ if(payload.containsKey("time_to_live")){
+ int ttl = (int)payload.get("time_to_live");
+ builder.timeToLive(ttl);
+ }
Message message = builder.build();
+
MulticastResult multicastResult = sender.send(message, ids, SEND_RETRIES);
LOG.debug("sendNotification result: {}", multicastResult);