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);