修复程序彻底退出后,点击通知收不到消息的bug

This commit is contained in:
zhangqinghe 2015-07-21 12:48:51 +08:00
parent b10bc7dbb4
commit c2f957acbe
2 changed files with 14 additions and 2 deletions

View File

@ -58,6 +58,8 @@ public class JPushPlugin extends CordovaPlugin {
public static String notificationAlert;
public static Map<String, Object> notificationExtras=new HashMap<String, Object>();
public static String openNotificationAlert;
public static Map<String, Object> openNotificationExtras=new HashMap<String, Object>();
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());
}

View File

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