From c2f957acbe76a214f230fbccfe8cd0627af17124 Mon Sep 17 00:00:00 2001 From: zhangqinghe Date: Tue, 21 Jul 2015 12:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A8=8B=E5=BA=8F=E5=BD=BB?= =?UTF-8?q?=E5=BA=95=E9=80=80=E5=87=BA=E5=90=8E=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=94=B6=E4=B8=8D=E5=88=B0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/android/JPushPlugin.java | 12 ++++++++++++ src/android/MyReceiver.java | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index 462bb6f..b669b65 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -58,6 +58,8 @@ public class JPushPlugin extends CordovaPlugin { public static String notificationAlert; public static Map notificationExtras=new HashMap(); + public static String openNotificationAlert; + public static Map openNotificationExtras=new HashMap(); public JPushPlugin() { instance = this; @@ -67,6 +69,16 @@ public class JPushPlugin extends CordovaPlugin { public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); //JPushInterface.setDebugMode(true); + + //JPushPlugin.notificationAlert = alert; + //JPushPlugin.notificationExtras = extras; + if(JPushPlugin.openNotificationAlert != null){ + JPushPlugin.transmitOpen(JPushPlugin.openNotificationAlert, JPushPlugin.openNotificationExtras); + } + if(JPushPlugin.notificationAlert!=null){ + JPushPlugin.transmitReceive(JPushPlugin.notificationAlert, JPushPlugin.notificationExtras); + } + //JPushInterface.init(cordova.getActivity().getApplicationContext()); } diff --git a/src/android/MyReceiver.java b/src/android/MyReceiver.java index ccd0749..2eff5d9 100644 --- a/src/android/MyReceiver.java +++ b/src/android/MyReceiver.java @@ -49,8 +49,8 @@ public class MyReceiver extends BroadcastReceiver { launch.addCategory(Intent.CATEGORY_LAUNCHER); launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP); - JPushPlugin.notificationAlert = alert; - JPushPlugin.notificationExtras = extras; + JPushPlugin.openNotificationAlert = alert; + JPushPlugin.openNotificationExtras = extras; JPushPlugin.transmitOpen(alert, extras);