diff --git a/build.properties b/build.properties index 3087000..c196372 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ -titanium.platform=/Users/jeroen/Library/Application Support/Titanium/mobilesdk/osx/5.1.2.GA/android +titanium.platform=/Users/jeroen/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA/android android.platform=/Users/jeroen/Library/android-sdk-macosx/platforms/android-14 google.apis=/Users/jeroen/Library/android-sdk-macosx/add-ons/addon-google_apis-google-15 -android.ndk=/Users/jeroen/Library/android-ndk-r10e +android.ndk=/Users/jeroen/Library/android-ndk-r12b diff --git a/manifest b/manifest index b766a5d..bc18887 100755 --- a/manifest +++ b/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 1.6 +version: 1.7 apiversion: 3 description: Google Cloud Push for Titanium author: Jeroen van Vianen diff --git a/src/nl/vanvianen/android/gcm/GCMIntentService.java b/src/nl/vanvianen/android/gcm/GCMIntentService.java index 36f2de7..87082ea 100755 --- a/src/nl/vanvianen/android/gcm/GCMIntentService.java +++ b/src/nl/vanvianen/android/gcm/GCMIntentService.java @@ -95,20 +95,20 @@ protected void onMessage(Context context, Intent intent) { HashMap data = new HashMap(); for (String key : intent.getExtras().keySet()) { - String value = intent.getExtras().getString(key); + Object value = intent.getExtras().get(key); Log.d(LCAT, "Message key: \"" + key + "\" value: \"" + value + "\""); - if (key.equals("from") && value != null && value.startsWith("/topics/")) { + if (key.equals("from") && value instanceof String && ((String) value).startsWith("/topics/")) { isTopic = true; } String eventKey = key.startsWith("data.") ? key.substring(5) : key; - data.put(eventKey, intent.getExtras().getString(key)); + data.put(eventKey, intent.getExtras().get(key)); - if (value.startsWith("{")) { + if (value instanceof String && ((String) value).startsWith("{")) { Log.d(LCAT, "Parsing JSON string..."); try { - JSONObject json = new JSONObject(value); + JSONObject json = new JSONObject((String) value); Iterator keys = json.keys(); while (keys.hasNext()) { @@ -118,9 +118,8 @@ protected void onMessage(Context context, Intent intent) { data.put(jKey, jValue); } - } - catch(JSONException e) { - Log.d(LCAT, "JSON error: " + e); + } catch(JSONException ex) { + Log.d(LCAT, "JSON error: " + ex.getMessage()); } } }