diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java index 186eee395..47f9d1bd9 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java @@ -369,14 +369,14 @@ protected void registerForPush(String iterableAppId, String gcmProjectNumber, bo * @param campaignId * @param templateId */ - protected void trackPushOpen(int campaignId, int templateId) { + protected void trackPushOpen(int campaignId, int templateId, String messageId) { JSONObject requestJSON = new JSONObject(); try { requestJSON.put(IterableConstants.KEY_EMAIL, _email); requestJSON.put(IterableConstants.KEY_CAMPAIGNID, campaignId); requestJSON.put(IterableConstants.KEY_TEMPLATE_ID, templateId); - + requestJSON.put(IterableConstants.KEY_MESSAGE_ID, messageId); } catch (JSONException e) { e.printStackTrace(); diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java index 0b8b2c075..2bac70d5e 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java @@ -20,6 +20,7 @@ public final class IterableConstants { public static final String KEY_RECIPIENT_EMAIL = "recipientEmail"; public static final String KEY_SEND_AT = "sendAt"; public static final String KEY_TEMPLATE_ID = "templateId"; + public static final String KEY_MESSAGE_ID = "messageId"; public static final String KEY_TOKEN = "token"; public static final String KEY_PLATFORM = "platform"; public static final String KEY_APPLICATIONNAME = "applicationName"; diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableNotificationData.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableNotificationData.java index aeb1d9236..96077f3e5 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableNotificationData.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableNotificationData.java @@ -9,6 +9,7 @@ class IterableNotificationData { private int campaignId; private int templateId; + private String messageId; private boolean isGhostPush; IterableNotificationData(String data){ @@ -22,6 +23,10 @@ class IterableNotificationData { templateId = iterableJson.getInt(IterableConstants.KEY_TEMPLATE_ID); } + if (iterableJson.has(IterableConstants.KEY_MESSAGE_ID)) { + messageId = iterableJson.getString(IterableConstants.KEY_MESSAGE_ID); + } + if (iterableJson.has(IterableConstants.IS_GHOST_PUSH)) { isGhostPush = iterableJson.getBoolean(IterableConstants.IS_GHOST_PUSH); } @@ -40,6 +45,8 @@ public int getTemplateId() return this.templateId; } + public String getMessageId() { return this.messageId; } + public boolean getIsGhostPush() { return this.isGhostPush; diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterablePushOpenReceiver.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterablePushOpenReceiver.java index 6d1f284ff..c3c345479 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterablePushOpenReceiver.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterablePushOpenReceiver.java @@ -32,7 +32,7 @@ public void onReceive(Context context, Intent intent) { IterableNotificationData iterableNotificationData = new IterableNotificationData(iterableDataString); if (IterableApi.sharedInstance != null) { IterableApi.sharedInstance.setNotificationData(iterableNotificationData); - IterableApi.sharedInstance.trackPushOpen(iterableNotificationData.getCampaignId(), iterableNotificationData.getTemplateId()); + IterableApi.sharedInstance.trackPushOpen(iterableNotificationData.getCampaignId(), iterableNotificationData.getTemplateId(), iterableNotificationData.getMessageId()); } } }