Service worker not listening push event when the URL is not opened

I want to integrate service worker to my web app and send push notification almost similar to Facebook (Send notification even if Faceook is not open)

My service worker and even push event is working fine, when the is opened in one of the tab. Any push event from server sends data to the UI perfectly fine. I can see the service worker status in this case. It shows “activated and running ” state.

But when the URL is not opened in any of the browser tab, the service worker do not listen to push event and even the Service Worker status shows “activated and stopped”.

Can any one please help me here. Is that expected to show Service worker status as “activated and stopped”?


Check this documentation to check if you missed something.

From there you will be able to inspect your work.

Adding Push Notifications to a Web App

What you’ll learn

  • How to subscribe and unsubscribe a user for push messaging
  • How to handle incoming push messages
  • How to display a notification
  • How to respond to notification clicks

You can check this SO post for further details.