usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [01/39] usergrid git commit: fix time_to_live gcm
Date Wed, 14 Oct 2015 16:53:57 GMT
Repository: usergrid
Updated Branches:
  refs/heads/usergrid-1007-shiro-cache 513eae4ac -> 542763185


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/32fcbb5b
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/32fcbb5b
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/32fcbb5b

Branch: refs/heads/usergrid-1007-shiro-cache
Commit: 32fcbb5be966d464a40c644752827dc6996e507a
Parents: 0c12abb
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Sat Sep 19 15:01:06 2015 -0400
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Sep 22 14:34:15 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/32fcbb5b/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);
 


Mime
View raw message