mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-21 04:42:53 +08:00
fix android openNotification twice
This commit is contained in:
parent
0da9f0ed26
commit
42d64ca2f0
@ -56,7 +56,9 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
private ExecutorService threadPool = Executors.newFixedThreadPool(1);
|
||||
private static JPushPlugin instance;
|
||||
private static String TAG = "Client JPushPlugin";
|
||||
|
||||
public static boolean bOpenNotificationAlert = true;
|
||||
public static String notificationAlert;
|
||||
public static Map<String, Object> notificationExtras=new HashMap<String, Object>();
|
||||
public static String openNotificationAlert;
|
||||
@ -73,12 +75,19 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
if(JPushPlugin.bOpenNotificationAlert){
|
||||
|
||||
JPushPlugin.bOpenNotificationAlert = false;
|
||||
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());
|
||||
}
|
||||
@ -226,7 +235,7 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
JSONArray.class, CallbackContext.class);
|
||||
method.invoke(JPushPlugin.this, data, callbackContext);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.toString());
|
||||
Log.e(TAG,e.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ public class MyReceiver extends BroadcastReceiver {
|
||||
Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
|
||||
launch.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
JPushPlugin.bOpenNotificationAlert = true;
|
||||
JPushPlugin.openNotificationAlert = alert;
|
||||
JPushPlugin.openNotificationExtras = extras;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user