cordova-plugin-local-notifications icon indicating copy to clipboard operation
cordova-plugin-local-notifications copied to clipboard

Manually clearing the notification from the notification center cancels scheduled notifications

Open jomorr opened this issue 4 years ago • 0 comments

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

  • Plugin version: 0.9 beta 3

  • Platform: Android

  • OS version: 10

  • Device manufacturer / model: Samsung Galaxy S9

  • Cordova version (cordova -v): 9.0.0

  • Cordova platform version (cordova platform ls): Installed platforms: android 9.0.0 ios 5.1.1

  • Plugin config

  • Ionic Version (if using Ionic)

Expected Behavior

1 - scheduled a notification with id: 1 2 - notification triggered and shows in the notification center 3 - as soon as it's triggered, the notification is scheduled again with a different trigger time, but same id: 1 4 - manually clear the notification in the notification center 5 - notification triggers based on the trigger time specified in the second trigger schedule

Actual Behavior

1 - scheduled a notification with id: 1 2 - notification triggered and shows in the notification center 3 - as soon as it's triggered, the notification is scheduled again with a different trigger time, but same id: 1 4 - manually clear the notification in the notification center 5 - notification is cancelled, and does not trigger at the scheduled time

Steps to Reproduce

Reproduced using the following code

var now = new Date().getTime();
_10_sec_from_now = new Date(now + 10*1000);

// scheduled the initial notification to trigger in 10 seconds.  This triggers successfully
cordova.plugins.notification.local.schedule({
    id: 1,
    title: "Notification Title",
    text: "Notification Message",
    at: _10_sec_from_now,
    foreground: true,
    group: 'groupA'
});

// Once the above triggers, reschedule the notification with a new title and message at a different interval
cordova.plugins.notification.local.on('trigger', function (notification) {
    var now = new Date().getTime();
    _30_sec_from_now = new Date(now + 30*1000);

    cordova.plugins.notification.local.schedule({
        id: notification.id,
        title: "Reset Notification Title",
        text: "Reset Notification Message",
        at: _30_sec_from_now,
        foreground: true,
        group: 'groupA'
    });
// This schedules successfully, but if the toast from the initial notification is cleared (swiped) from the notification center, this notification is cancelled.
});

Context

Schedule a new notification once the previous one has fired - using the same id (since that id is not longer in use).

Debug logs

None

jomorr avatar Sep 25 '20 18:09 jomorr