Local Notifications Action for the web

Hi everyone,

I was trying to use the local notifications (https://capacitor.ionicframework.com/docs/apis/local-notifications)

    notifications: [
        id: 1,
        title: 'Hello',
        body: 'World',
        schedule: { at: new Date(Date.now()) },
        extra: null,

// adding the listener
LocalNotifications.addListener('localNotificationActionPerformed', (payload) => {
      // triggers when the notification is clicked.
      console.log('notification triggered:', payload);

It works as expected on iOS… but on the (web) browser, nothing happens after clicking the notification (i.e. no console.log). :confused:

Please let me know if I am missing something.

I am using;
@ionic/react: v5

Any help would be really appreciated. Thank you.

1 Like

Hmm, it seems the web version doesn’t provide a addListener method, though it exists in the global definition.

Looking through the web notification API, it seems like there are only a handful of events that can be emitted from the notification.

I would submit an issue to capacitor regarding this (and maybe even send a pull request to add this?)