Преглед на файлове

Update to LocalNotification.cancel()

Based on this answer from CommonsWare http://stackoverflow.com/a/16340703/2163901

When canceling a PendingIntent, there's no need to pass in extra flags to PendingIntent.getBroadcast. When you pass the flag in, the PendingIntent is not really cancelled. This can be confirmed by using the dumpsys utility as such: adb shell dumpsys alarm.
ginovva320 преди 11 години
родител
ревизия
da1f1d41dc
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/android/LocalNotification.java

+ 2 - 2
src/android/LocalNotification.java

@@ -186,7 +186,7 @@ public class LocalNotification extends CordovaPlugin {
         Intent intent = new Intent(context, Receiver.class)
             .setAction("" + notificationId);
 
-        PendingIntent pi       = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
+        PendingIntent pi       = PendingIntent.getBroadcast(context, 0, intent, 0);
         AlarmManager am        = getAlarmManager();
         NotificationManager nc = getNotificationManager();
 
@@ -354,4 +354,4 @@ public class LocalNotification extends CordovaPlugin {
     protected static NotificationManager getNotificationManager () {
         return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
     }
-}
+}