diff --git a/src/android/com/adobe/phonegap/push/FCMService.java b/src/android/com/adobe/phonegap/push/FCMService.java index 48c01bbdb..af9ebb028 100644 --- a/src/android/com/adobe/phonegap/push/FCMService.java +++ b/src/android/com/adobe/phonegap/push/FCMService.java @@ -193,7 +193,7 @@ private String localizeKey(Context context, String key, String value) { /* * Replace alternate keys with our canonical value */ - private String normalizeKey(String key, String messageKey, String titleKey) { + private String normalizeKey(String key, String messageKey, String titleKey, Bundle newExtras) { if (key.equals(BODY) || key.equals(ALERT) || key.equals(MP_MESSAGE) || key.equals(GCM_NOTIFICATION_BODY) || key.equals(TWILIO_BODY) || key.equals(messageKey) || key.equals(AWS_PINPOINT_BODY)) { return MESSAGE; @@ -203,6 +203,9 @@ private String normalizeKey(String key, String messageKey, String titleKey) { return COUNT; } else if (key.equals(SOUNDNAME) || key.equals(TWILIO_SOUND)) { return SOUND; + } else if (key.equals(AWS_PINPOINT_PICTURE)) { + newExtras.putString(STYLE, STYLE_PICTURE); + return PICTURE; } else if (key.startsWith(GCM_NOTIFICATION)) { return key.substring(GCM_NOTIFICATION.length() + 1, key.length()); } else if (key.startsWith(GCM_N)) { @@ -249,13 +252,13 @@ private Bundle normalizeExtras(Context context, Bundle extras, String messageKey Log.d(LOG_TAG, "key = data/" + jsonKey); String value = data.getString(jsonKey); - jsonKey = normalizeKey(jsonKey, messageKey, titleKey); + jsonKey = normalizeKey(jsonKey, messageKey, titleKey, newExtras); value = localizeKey(context, jsonKey, value); newExtras.putString(jsonKey, value); } } else if (data.has(LOC_KEY) || data.has(LOC_DATA)) { - String newKey = normalizeKey(key, messageKey, titleKey); + String newKey = normalizeKey(key, messageKey, titleKey, newExtras); Log.d(LOG_TAG, "replace key " + key + " with " + newKey); replaceKey(context, key, newKey, extras, newExtras); } @@ -263,7 +266,7 @@ private Bundle normalizeExtras(Context context, Bundle extras, String messageKey Log.e(LOG_TAG, "normalizeExtras: JSON exception"); } } else { - String newKey = normalizeKey(key, messageKey, titleKey); + String newKey = normalizeKey(key, messageKey, titleKey, newExtras); Log.d(LOG_TAG, "replace key " + key + " with " + newKey); replaceKey(context, key, newKey, extras, newExtras); } @@ -274,7 +277,7 @@ private Bundle normalizeExtras(Context context, Bundle extras, String messageKey String notifkey = iterator.next(); Log.d(LOG_TAG, "notifkey = " + notifkey); - String newKey = normalizeKey(notifkey, messageKey, titleKey); + String newKey = normalizeKey(notifkey, messageKey, titleKey, newExtras); Log.d(LOG_TAG, "replace key " + notifkey + " with " + newKey); String valueData = value.getString(notifkey); @@ -289,7 +292,7 @@ private Bundle normalizeExtras(Context context, Bundle extras, String messageKey // with the other "message" key (holding the body of the payload) // See issue #1663 } else { - String newKey = normalizeKey(key, messageKey, titleKey); + String newKey = normalizeKey(key, messageKey, titleKey, newExtras); Log.d(LOG_TAG, "replace key " + key + " with " + newKey); replaceKey(context, key, newKey, extras, newExtras); } diff --git a/src/android/com/adobe/phonegap/push/PushConstants.java b/src/android/com/adobe/phonegap/push/PushConstants.java index 9a20a61f2..02f885e93 100644 --- a/src/android/com/adobe/phonegap/push/PushConstants.java +++ b/src/android/com/adobe/phonegap/push/PushConstants.java @@ -72,6 +72,7 @@ public interface PushConstants { public static final String TWILIO_TITLE = "twi_title"; public static final String TWILIO_SOUND = "twi_sound"; public static final String AWS_PINPOINT_BODY = "pinpoint.notification.body"; + public static final String AWS_PINPOINT_PICTURE = "pinpoint.notification.imageUrl"; public static final String AWS_PINPOINT_PREFIX = "pinpoint.notification"; public static final String MP_MESSAGE = "mp_message"; public static final String START_IN_BACKGROUND = "cdvStartInBackground";