katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.76k forks source link

clear() does not remove the notification on Android #2038

Closed jdevuono54 closed 2 months ago

jdevuono54 commented 2 months ago

I encountered an issue while trying to clear a specific notification using the clear() method. In my main project, the notification is not removed when using clear(), but it is removed when using clearAll().

To troubleshoot, I created a new, minimal Cordova project with only the basic setup and the Cordova Local Notification plugin. However, I still encountered the same issue: the notification is not cleared when using clear(), but clearAll() works as expected.

Your Environment

Expected Behavior

The notification with id: 6546 should be cleared when using clear([6546]).

Actual Behavior

The notification is not cleared when using clear([6546]), but it is cleared when using clearAll().

Steps to Reproduce

Create a new Cordova project and install the Local Notification plugin. Schedule a notification using the following code:

cordova.plugins.notification.local.schedule([
    {
        id: 6546,
        title: 'My first notification',
        text: 'Thats pretty easy...',
        foreground: true
    }
]);

Attempt to clear the notification after a delay using the clear() method:

setTimeout(() => {
    // Does not work
    cordova.plugins.notification.local.clear([6546]);

    // Works
    cordova.plugins.notification.local.clearAll();
}, 5000);
GitToTheHub commented 2 months ago

Hi, can you check, if you really use the master version of the plugin? Because this was 2 days ago fixed in the master. Please remove the plugin, add it again and check if the problem persists. Regards

jdevuono54 commented 2 months ago

Hey ! Indeed, I wasn't using the latest version, and it seems to be working again, thanks ! I'm not pointing directly to the master branch but to a specific SHA to avoid any unwanted changes while waiting for a new version to be released.

GitToTheHub commented 2 months ago

Ok, good to hear, that it works now 🙂