New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle Notification click events (cannot find docs) #22311

Closed
petivagyok16 opened this Issue Feb 19, 2018 · 9 comments

Comments

Projects
None yet
@petivagyok16

petivagyok16 commented Feb 19, 2018

I'm submitting a...

[X] Documentation issue or request

Current behavior

Currently, its not clear how to handle notification clicks with angular service worker.

Expected behavior

Finding a source how to handle notification clicks in web push in PWA would be great! :) thanks

Minimal reproduction of the problem with instructions

Just send a push notification with actions like

let notificationData = {}
  notificationData.notification = {
    title: notification.title,
    actions: [{
      action: 'openapp',
      title: 'Open App'
    }],
    body: notification.body,

and clicking on Open App in the push notification wont work.

What is the motivation / use case for changing the behavior?

It's a widely requested feature .

Environment


Angular version: 5.2.5

Browser:
- [x] Chrome (desktop) version 64

For Tooling issues:
- Node version: 9.3 
- Platform:  
Mac
@kapunahelewong

This comment has been minimized.

Contributor

kapunahelewong commented Feb 22, 2018

@bolajipemipo

This comment has been minimized.

bolajipemipo commented Mar 9, 2018

Hello, please is there anyone on this?

Have really relied on Angular SW. Would really be glad if a solution comes out soon.

Thanks.

@umutc

This comment has been minimized.

umutc commented Mar 17, 2018

Hello everybody

I wrote an an App as Angular 5 PWA. When I sent a web-push, the notification comes both Android PWA and Mac Chrome PWA.
When I click the notification on Mac : If chrome opened and not focused, focusing the chrome's current page. If chrome closed not opening a new chrome window as app.magistum.com.
When I click the notification on Android device nothing happens.

I thing at least the magistum.apk or app.magistum.com should open when I click the notification.

Best regards.

Payload:
{ "notification": { "title": "Hello!", "body": "Magistum transform your school.", "icon": "assets/main-page-logo-small-hat.png", "vibrate": [ 100, 50, 100 ], "data": { "created_at": 1521327416 }, "actions": [ { "action": "explore", "title": "Go to the site" }, { "action": "go_to_homework", "title": "Go to homework" } ] } }

@u-ryo

This comment has been minimized.

u-ryo commented Mar 19, 2018

Handling the 'notificationclick' event hasn't seem implemented in the current(=5.2.0) Angular5 yet.
I posted a workaround on another issue #20956 (comment)

@sinasava

This comment has been minimized.

sinasava commented Jun 8, 2018

Any update in Angular 6?

@chembu

This comment has been minimized.

Contributor

chembu commented Jun 8, 2018

@choopage

This comment has been minimized.

choopage commented Jun 13, 2018

@u-ryo thanks for the workaround in #20956 and this repo https://github.com/u-ryo/angular-swpush to reference for the workaround. It was also worth mentioning that in angular/mobile-toolkit#178 that
@webmaxru noted that extending the capability is the way.

A point to note, the swPush without built-in notification click_action is like a bird without wings. Using a workaround is like giving the bird an artificial wings, but why? What is the impetus/motivation behind this design of swPush?

@chembu would appreciate if you could extend the swPush with built-in notification click_action. Many thanks.

@chembu

This comment has been minimized.

Contributor

chembu commented Jun 13, 2018

joostme added a commit to joostme/angular that referenced this issue Sep 7, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Sep 7, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311
@gkalpak

This comment has been minimized.

Member

gkalpak commented Sep 17, 2018

Closing as duplicate of #20956.

@gkalpak gkalpak closed this Sep 17, 2018

joostme added a commit to joostme/angular that referenced this issue Sep 21, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Sep 28, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Oct 1, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Oct 3, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Oct 12, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Oct 12, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

joostme added a commit to joostme/angular that referenced this issue Oct 15, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

IgorMinar added a commit to joostme/angular that referenced this issue Nov 1, 2018

feat(service-worker): handle 'notificationclick' events
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

kara added a commit that referenced this issue Nov 1, 2018

feat(service-worker): handle 'notificationclick' events (#25860)
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes #20956, #22311

PR Close #25860

sculove added a commit to sculove/angular that referenced this issue Nov 2, 2018

feat(service-worker): handle 'notificationclick' events (angular#25860)
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes angular#20956, angular#22311

PR Close angular#25860
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment