3

I have implemented everything regarding Push Notifications on my Angular PWA (according to Angular Service Worker Notifications) and even got the notifications to be shown by the browser, however, when clicking on any button (or on the notification itself), it just closes and the respective action does not happen.


The versions being used are:

"@angular/core": "~11.2.6",
"@angular/pwa": "^0.1102.5",
"@angular/service-worker": "~11.2.6",

I have tried different notification payloads, and they all get shown:

{
  "notification": {
    "title": "New Notification!",
    "actions": [
      {"action": "foo", "title": "Open new tab"},
      {"action": "bar", "title": "Focus last"},
      {"action": "baz", "title": "Navigate last"},
      {"action": "qux", "title": "Send request in the background"},
      {"action": "other", "title": "Just notify existing clients"}
    ],
    "data": {
      "onActionClick": {
        "default": {"operation": "openWindow"},
        "foo": {"operation": "openWindow", "url": "/absolute/path"},
        "bar": {"operation": "focusLastFocusedOrOpen", "url": "relative/path"},
        "baz": {"operation": "navigateLastFocusedOrOpen", "url": "https://other.domain.com/"},
        "qux": {"operation": "sendRequest", "url": "https://yet.another.domain.com/"}
      }
    }
  }
}

Push Notification Shown


But, when clicked, nothing happens and the notificationClicks fallback Observable gets notified:

Angular Info


What am I missing here?

Thank you very much in advance!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.