mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-03-17 06:21:05 +08:00
fix bug
fix bug about add local notification.
This commit is contained in:
parent
01a89fd293
commit
5a1aa16e40
@ -465,13 +465,16 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
|
|
||||||
void addLocalNotification(JSONArray data, CallbackContext callbackContext)
|
void addLocalNotification(JSONArray data, CallbackContext callbackContext)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
//builderId,content,title,notificaitonID,broadcastTime,extras
|
|
||||||
int builderId = data.getInt(0);
|
int builderId = data.getInt(0);
|
||||||
String content = data.getString(1);
|
String content = data.getString(1);
|
||||||
String title = data.getString(2);
|
String title = data.getString(2);
|
||||||
int notificationID = data.getInt(3);
|
int notificationID = data.getInt(3);
|
||||||
int broadcastTime = data.getInt(4);
|
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();
|
JPushLocalNotification ln = new JPushLocalNotification();
|
||||||
ln.setBuilderId(builderId);
|
ln.setBuilderId(builderId);
|
||||||
@ -479,8 +482,8 @@ public class JPushPlugin extends CordovaPlugin {
|
|||||||
ln.setTitle(title);
|
ln.setTitle(title);
|
||||||
ln.setNotificationId(notificationID);
|
ln.setNotificationId(notificationID);
|
||||||
ln.setBroadcastTime(System.currentTimeMillis() + broadcastTime);
|
ln.setBroadcastTime(System.currentTimeMillis() + broadcastTime);
|
||||||
|
|
||||||
ln.setExtras(extras.toString());
|
ln.setExtras(extras.toString());
|
||||||
|
|
||||||
JPushInterface.addLocalNotification(cordovaActivity, ln);
|
JPushInterface.addLocalNotification(cordovaActivity, ln);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user