How to update FCM notification data in stores when the browser tab is not active through service worker?

Viewed 275

I am using FCM in reactjs application. Majorly we have three cases to handle notifications.

  1. App is opened and is in active state
  2. App is opened and is in inactive state
  3. App is not opened

In first case, we no need to display a chrome notification as tab is in active state and I am able to update FCM data in app stores.

In third case, once the user clicked on notification we will freshly open the page and fetch new messages. So no problem with this case as well

But in second case, the tab is opened but not in active state. I am able to display a notification through firebase-messaging-sw.js but how to update the FCM data in app stores as I am not able to import app stores in service worker?

0 Answers
Related