Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

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

Open
FluorescentHallucinogen opened this issue Sep 12, 2017 · 3 comments

Comments

@FluorescentHallucinogen

<firebase-messaging
id="messaging"
token="{{token}}"
on-message="handleMessage">
</firebase-messaging>
<firebase-document
path="/users/[[user.uid]]/token"
data="[[token]]">
</firebase-document>

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
Copy link
Author

@robdodson PTAL.

@robdodson
Copy link
Contributor

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

@tabebqena
Copy link

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 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants