From 5a1aa16e4019a4dc9abfb08284f88da407bf9fe3 Mon Sep 17 00:00:00 2001 From: Hevin <328066446@qq.com> Date: Tue, 12 Apr 2016 14:49:42 +0800 Subject: [PATCH] fix bug fix bug about add local notification. --- src/android/JPushPlugin.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index bfce837..5f06824 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -465,13 +465,16 @@ public class JPushPlugin extends CordovaPlugin { void addLocalNotification(JSONArray data, CallbackContext callbackContext) throws JSONException { - //builderId,content,title,notificaitonID,broadcastTime,extras int builderId = data.getInt(0); String content = data.getString(1); String title = data.getString(2); int notificationID = data.getInt(3); int broadcastTime = data.getInt(4); - JSONObject extras = data.getJSONObject(5); + String extrasStr = data.isNull(5) ? "" : data.getString(5); + JSONObject extras = new JSONObject(); + if (!extrasStr.isEmpty()) { + extras = new JSONObject(extrasStr); + } JPushLocalNotification ln = new JPushLocalNotification(); ln.setBuilderId(builderId); @@ -479,8 +482,8 @@ public class JPushPlugin extends CordovaPlugin { ln.setTitle(title); ln.setNotificationId(notificationID); ln.setBroadcastTime(System.currentTimeMillis() + broadcastTime); - ln.setExtras(extras.toString()); + JPushInterface.addLocalNotification(cordovaActivity, ln); }