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

Commit

Permalink
Issue #126: It is using in gcm data.additionalData?
Browse files Browse the repository at this point in the history
  • Loading branch information
macdonst committed Sep 13, 2015
1 parent 6b5bebb commit dbfb70b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/android/com/adobe/phonegap/push/PushPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class PushPlugin extends CordovaPlugin {
public static final String INITIALIZE = "init";
public static final String UNREGISTER = "unregister";
public static final String EXIT = "exit";
public static final String GCM_NOTIFICATION = "gcm.notification";

private static CallbackContext pushContext;
private static CordovaWebView gWebView;
Expand Down Expand Up @@ -186,6 +187,9 @@ private static JSONObject convertBundleToJson(Bundle extras) {
Object value = extras.get(key);

Log.d(LOG_TAG, "key = " + key);
if (key.startsWith(GCM_NOTIFICATION)) {
key = key.substring(GCM_NOTIFICATION.length()+1, key.length());
}

// System data from Android
if (key.equals("from") || key.equals("collapse_key")) {
Expand All @@ -196,21 +200,15 @@ else if (key.equals("foreground")) {
}
else if (key.equals("coldstart")){
additionalData.put(key, extras.getBoolean("coldstart"));
} else if (key.equals("message") || key.equals("body") ||
key.equals("gcm.notification.message") ||
key.equals("gcm.notification.body")) {
} else if (key.equals("message") || key.equals("body")) {
json.put("message", value);
} else if (key.equals("title") || key.equals("gcm.notification.title")) {
} else if (key.equals("title")) {
json.put("title", value);
} else if (key.equals("msgcnt") || key.equals("badge") ||
key.equals("gcm.notification.msgcnt") ||
key.equals("gcm.notification.badge")) {
} else if (key.equals("msgcnt") || key.equals("badge")) {
json.put("count", value);
} else if (key.equals("soundname") || key.equals("sound") ||
key.equals("gcm.notification.soundname") ||
key.equals("gcm.notification.sound")) {
} else if (key.equals("soundname") || key.equals("sound")) {
json.put("sound", value);
} else if (key.equals("image") || key.equals("gcm.notification.image")) {
} else if (key.equals("image")) {
json.put("image", value);
} else if (key.equals("callback")) {
json.put("callback", value);
Expand Down

0 comments on commit dbfb70b

Please sign in to comment.