Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to de-duplicate notifications between native and progressive web app?

If I have both a native app and a progressive web app using web push notifications powered by service worker, is there a way to prevent a user from receiving duplicate notifications if they opt in to receiving notifications from the web site and also have the app installed?

like image 431
owencm Avatar asked Nov 20 '15 23:11

owencm


People also ask

Can PWA have 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.

What is duplicate notification?

Android devices with 2 copies of the app installed on the device can also receive duplicate notifications. This could happen if you have a production and staging / dev app installed at the same time with different Android package names. This would result in two different player_ids and two different push tokens.

Does iOS support PWA push notifications?

Progressive Web Apps is a trend in 2019 and web push notifications for iOS are not supported right now.


1 Answers

In short - there is no easy way to do this today.

There is a discussion on Chrome here on this: https://code.google.com/p/chromium/issues/detail?id=402223

The last comment from October 2015:

For now the safest minimal solution is for sites to provide an easy opt out mechanism (which we strongly recommend you do anyway!) so users can turn off notifications from one platform

Another possible heuristic based solution is to take some measure for which interface (web or native) the user most often uses (or most recently used) and only send to that. Combined with grouping these devices by rough screen size should give a pretty good approximation.

The issue is that if the user has two similar sized devices and uses native on one and web on the other then notifications will only be delivered to one, which is an edge case.

We've also been discussing building an API so sites can tell whether their corresponding native app is installed to avoid this case, but need to start discussing that with other browser vendors to see if they'd be supportive.

like image 66
Matt Gaunt Avatar answered Jan 02 '23 12:01

Matt Gaunt