gollyzoom
gollyzoom

Reputation: 559

How should device tokens be used with Firebase Cloud Messaging

My question is not really a technical bug question but more of a broad outline question. Background: I am building a web app, and I want to use FCM in this webapp. Since a user could sign in from multiple devices, I want to create a device cluster for each user so that when someone messages them, the message will go to all devices where they are signed in. I know that I'm supposed to collect a device token, add it to the user's device cluster, and send messages to the notification key for that device cluster. However, I'm a little confused about when I should add and remove these device tokens. E.g., when a user logs onto the site, should I add the device token to that person's cluster? When they log out, should I remove the token? what do I do when the device token expires and a new device token is generated? Do I have to remove the old token from the user's cluster manually, or is it automatically removed when it expires? Do I need to add the new token to the user's device cluster? Is there any way to delete an entire device cluster, instead of removing one device at a time? I've read the documentation, but I still can't find the answers to these questions. Any advice and/or other things I should know but didn't ask about would be much appreciated. Thanks in advance!

Upvotes: 0

Views: 245

Answers (0)

Related Questions