Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

offline push notifications for progressive web apps

Is it possible to trigger push notifications (on iOS and/or Android) from a web application while offline?

As I understand it, even with a Service Worker background process, push notifications are always triggered via a server - which seems to preclude reliable offline reminders or anything like that.

like image 331
AnC Avatar asked Apr 08 '17 07:04

AnC


People also ask

Can Progressive Web Apps send push notifications?

Progressive Web Applications (PWA) make native push notifications available to any website using a service worker on just about every platform and browser. The power of web app push notifications is being able to engage customers without a native app.

Can Progressive Web Apps be used offline?

Our app is caching its resources on install and serving them with fetch from the cache, so it works even if the user is offline.

Do push notifications work offline?

The Push API allows the app to display these notifications even when the app is offline. On mobile, Push notifications can even show up if the phone is locked. Background service workers make it possible to send messages when offline.

Do push notifications work when browser is closed?

This means the browser can have no windows open, and you'll still receive the push message in your service worker, because the browser in running in the background. The only time a push won't be received is when the browser is completely closed, i.e. not running at all (no marking).


1 Answers

There is Notifications which works offline, but you cannot call it from "background" (e.g. when your web page is closed).

"Background task" (or similar feature) is not available yet on the web, and I'm not sure it's a good idea to bring that power to the web. The closest thing you can do that sounds like "background" is MediaSession that allows you to play music and handle media controls on your hardware devices.

like image 63
Tony Dinh Avatar answered Oct 19 '22 03:10

Tony Dinh