polycasts icon indicating copy to clipboard operation
polycasts copied to clipboard

[ep59-firebase-messaging] How to save tokens from multiple devices w/o overwriting?

Open FluorescentHallucinogen opened this issue 8 years ago • 3 comments

https://github.com/Polymer/polycasts/blob/6e0ae5227bad9693f58f00152804adfca218c651/ep59-firebase-messaging/public/my-subscription.html#L27-L36

What if the user opens the web app and enable notifications on multiple devices? The token from one device will overwrite the token from another device. How to save tokens without overwriting to send push notifications to all devices?

FluorescentHallucinogen avatar Sep 12 '17 19:09 FluorescentHallucinogen

@robdodson PTAL.

FluorescentHallucinogen avatar Sep 12 '17 19:09 FluorescentHallucinogen

hm good question. I don't know enough about firebase to know what the best answer is. @michaelbleigh any ideas?

robdodson avatar Sep 26 '17 20:09 robdodson

I think that the applicable logarithm is :

  1. Get Id from your application or device , this depends on your app (browser finger print , android device Id etc).
  2. Register token in path like : users/token/userId/Unique_Id_Retrieved_in_Step_one.

the first step is challenging ; I think this is the best resource for android Id [https://stackoverflow.com/a/17625641/2390992](get Unique Id from android app) & this is the best resource for [https://stackoverflow.com/questions/4935964/javascript-unique-browser-id](getting unique Id from browser )

tabebqena avatar Dec 31 '18 16:12 tabebqena