Polymer / polycasts

Other
220 stars 134 forks source link

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

Open FluorescentHallucinogen opened 7 years ago

FluorescentHallucinogen commented 7 years ago

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 commented 7 years ago

@robdodson PTAL.

robdodson commented 6 years ago

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

tabebqena commented 5 years ago

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 )