Reputation: 5867
I've been experimenting with Progressive Web Apps (PWA) and using service workers to create native Notifications on phones (like a Galaxy s7/s8).
All has been working great if the page/PWA is open or in the background/tasks (super slick :D), but one thing I've noticed is that if it is killed via the task manager, the notifications no longer work.
This seems to be the case whether I'm using the web app in the browser or if I add it to home page using the PWA functionality.
Here is a snippet of a simple piece of logic in case it helps:
if (Notification.permission === 'granted') {
navigator.serviceWorker.ready.then(function(serviceWorker) {
serviceWorker.showNotification('You have new notifications!');
});
}
Questions
1) Is this an inherent limitation of PWA's?
2) Is there a workaround (like auto-starting the app, perhaps)?
Upvotes: 2
Views: 1092
Reputation: 999
All has been working great if the page/PWA is open or in the background/tasks (super slick :D), but one thing I've noticed is that if it is killed via the task manager, the notifications no longer work.
I beg to differ. I have created a PWA for a bus app and even if I kill the app, I still receive the notification.
To answer your questions:
Upvotes: 1