Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Issue #343: Handle both data and notification payloads in the same GC…
Browse files Browse the repository at this point in the history
…M push
  • Loading branch information
macdonst committed Nov 18, 2015
1 parent ac37fbb commit 603288e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/android/com/adobe/phonegap/push/GCMIntentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private Bundle normalizeExtras(Bundle extras) {

Log.d(LOG_TAG, "key = " + key);

// If the key is "data" or "message" and the value is a json object extract
// If normalizeKeythe key is "data" or "message" and the value is a json object extract
// This is to support parse.com and other services. Issue #147 and pull #218
if (key.equals(PARSE_COM_DATA) || key.equals(MESSAGE)) {
Object json = extras.get(key);
Expand All @@ -167,6 +167,19 @@ private Bundle normalizeExtras(Bundle extras) {
Log.e(LOG_TAG, "normalizeExtras: JSON exception");
}
}
} else if (key.equals(("notification"))) {
Bundle value = extras.getBundle(key);
Iterator<String> iterator = value.keySet().iterator();
while (iterator.hasNext()) {
String notifkey = iterator.next();

Log.d(LOG_TAG, "notifkey = " + notifkey);
String newKey = normalizeKey(notifkey);
Log.d(LOG_TAG, "replace key " + notifkey + " with " + newKey);

newExtras.putString(newKey, value.getString(notifkey));
}
continue;
}

String newKey = normalizeKey(key);
Expand Down

0 comments on commit 603288e

Please sign in to comment.