1

firebase.messaging.getToken() returns a string token. Let's call this fcmToken. I want to save this fcmToken to Firebase Realtime database as the key. Put another way, the data structure would look like this { $uid : { fcmToken1 : timestamp1, fcmToken2 : timestamp2, fcmTokenN : timestampN } }

What is the maximum length of a FCM token? It is because I want to save the FCM token as a key in Firebase Realtime database?

Jek
  • 5,546
  • 9
  • 37
  • 67
  • Also is there a better approach/data structure than my proposed one in saving multiple fcmToken from a user in Firebase Realtime database? – Jek May 04 '18 at 09:27
  • Why you need that? You can save many `fcmTokens` corresponding to `userId`. – TheTiger May 04 '18 at 09:28
  • 1
    Your structure should be like `{ $uid : { autoGeneratedKey :{ token :fcmToken1, timeStamp: timestamp1}, { autoGeneratedKey :{ token :fcmToken2, timeStamp: timestamp2 }` – TheTiger May 04 '18 at 09:34
  • I agree. I have feedback to Firebase team for their firebase sample to consider. https://github.com/firebase/functions-samples/issues/397 – Jek May 12 '18 at 03:27

0 Answers0