FCM on different bowsers on a single device--Web app

196 views
Skip to first unread message

Chrispen Mujeye

unread,
Oct 17, 2022, 9:28:58 PM10/17/22
to Firebase Google Group
Good Day,

Short story:  How do I check if there is already a registration token for a web app instance?
Long Story:
I want our users to receive notifications as much as possible especially when they use different browsers on a single device or across devices. We have a switch for push notifications. So let's say a user subscribed for push notifications on our web app on chrome browser on their device. We get a token for them and serve it to our database. Now the user visits our site on same device but this time around on chrome. Assume that the user might move away from using chrome browser. We still want this user to receive on safari browser....at this point I am generating a new token as long I know the user is subscribed for push notifications.
However, I need to be able to confirm if there is already an existing token for the web app instance on safari browser or not....if so , how do I check using javascript. Else, Is there a way to identify web app instance? That is if it's somehow stable over time. I can save that instanceId with the token to the database. I hope I explained my dilemma clearly.If not , please give me a shout. I don't want to end up having so many tokens for a single web app instance.I know the other ones will be stale but I would rather limit unnecessary generation of tokens. 

Any suggestion is much appreciated. Thank you.

Kind Regards
Reply all
Reply to author
Forward
0 new messages