Ad

How To Structure Push Token For Multiple Apps In A Single Firebase Database

Suppose I have 3 Apps sharing the same single Firebase database, and all Apps have Android/iOS version. How could I structure the JSON hierarchy in Firebase Database? The following image is my current push token JSON structures. Any better suggestion for pushing only one specified App, and other two Apps receive nothing? Thanks!

enter image description here

Ad

Answer

For you scenario, I would probably just go ahead with storing the other tokens under the same (user) node. So just edit what you already have to something like this:

/pushTokens
  /$userId
    /appId1:token1
    /appId2:token2
    /appId3:token3

I don't know why you still need the userId node inside the actual node that uses it as a key though.

Ad
source: stackoverflow.com
Ad