How to receive push notification with closed pwa

1,217 views
Skip to first unread message

Tharles Ribeiro Pereira

unread,
Mar 6, 2023, 2:39:24 PM3/6/23
to Chromium-dev
Hi all! Is there any way to receive the notification with the pwa closed? using service-worker.

I have a project, where the service-worker is registered, the user already receives notifications from the push notifications api, but when the pwa is closed, the notifications no longer reach the user, and if he enters the pwa, he will receive the delayed notifications.

I wanted someone's help, and if it is possible to do with the site or pwa closed.

I don't know, using 'sync'

K. Moon

unread,
Mar 6, 2023, 2:45:43 PM3/6/23
to tharl...@gmail.com, Chromium-dev
This sounds more like a Web development question, rather than a Chromium development (working on the browser itself) question.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/61b05fd9-a630-4825-b5a9-df0aa35660edn%40chromium.org.

Reilly Grant

unread,
Mar 7, 2023, 2:23:17 PM3/7/23
to km...@chromium.org, tharl...@gmail.com, Chromium-dev
This does touch on Chromium development a bit because there are constraints on how the Push API works that are dictated by the browser implementation. In Chrome on Windows, macOS and Linux a Service Worker will only be launched to handle a push event if the browser is running. This means that if the user closes an installed web app and that was the last open browser window then the browser will exit and not be able to receive push notifications. This isn't an issue on Android (because push notifications are delivered via the OS and will launch the browser to handle them) or on ChromeOS (where the browser never exits).

Running a persistent background service to handle push notifications has been investigated but my understanding is that there are a number of complexities which have prevented that solution from being implemented.
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


Reply all
Reply to author
Forward
0 new messages