Anyone using push notifications for PWA?

0
Hi,We use an online PWA and have implemented push notifications. Although we got it working, it does have its quirks. When the PWA is not active and not running in the background, it works. The notification is shown and clikcing it takes you to the path in the weblink.When the PWA is active it does nothing. The notification is not shown. Annoying but described in the documenation ( https://docs.mendix.com/refguide/mobile/using-mobile-capabilities/push-notifications/notif-send-test/#troubleshoot )And when the PWA is in the background, the notification is shown. Clinking on it will bring the PWA to the foreground but it will not trigger the path in the weblink.Does anyone use the push notification with a PWA? And did you manage to solve any of these issues?
asked
1 answers
-1

From my experience,, this behavior is mostly related to how the browser handles PWA notifications and service workers.


When the PWA is completely closed, the service worker handles the notification, so the click action works as expected.


When the PWA is already open, the browser keeps the active session and does not always trigger the notification flow. This is expected behavior.


For the background case, the notification appears because the service worker receives it, but clicking it only brings the PWA window to the foreground. The navigation URL/action needs to be handled separately.


What I usually do is:

  • keep the notification payload simple
  • pass the required page/path information with the notification data
  • handle the click event and route the user inside the Mendix app after the PWA gets focus


Also verify that the URL you pass is accessible after login/session restore, otherwise the PWA will just open the app homepage.


This is more of a PWA/browser limitation than a Mendix issue. The behavior can also vary between Chrome, Edge, mobile browsers, etc.


Kindly mark this as the accepted answer if it helps.

answered