设备令牌过期后,是否会自动将其从FCM设备组中删除? [英] When device token expires, is it automatically removed from FCM device group?

查看:91
本文介绍了设备令牌过期后,是否会自动将其从FCM设备组中删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Firebase Cloud Messaging,我还很陌生,而且我对这个问题还没有得到满意的答案(也很抱歉.全部停下来.很遗憾,我在2017年买了一台Macbook.年,苹果决定尝试使用其键盘-扰流板警报,坏主意-且空格键已损坏). 当用户登录到新设备时,我检索设备令牌并将其添加到该用户的设备组中. 无论如何,我是.使用.火力基地.云消息传递. (FCM)在用户之间发送消息. 什么时候.用户.注销,I.删除.该设备令牌.用户的设备组.我的问题.是,如果令牌过期且需要添加.设备组的新令牌,我是否必须这样做.删除旧令牌,或者FCM自动删除过期的令牌/令牌.出于任何原因不再有效.设备组,或者它们只是堆积而需要手动删除(即由我删除).谢谢!

I'm pretty new to Firebase Cloud Messaging, and I haven't been able to get a satisfactory answer to this question yet (also, sorry for. all the full. stops, unfortunately I bought a macbook. in. 2017, the year apple decided to experiment. with its keyboard - spoiler alert, bad idea - and the. space key is. broken). When a user logs in on a new device, I retrieve the device token and add it to that user's device group. In any event, I. am. using. Firebase. Cloud Messaging. (FCM) to send messages between users. When. the user. logs out, I. remove. that device token from that. user's device group. My question. is, if the token expires and I. need to add. the new token to the device group, do I. have to. remove the old token, or does FCM automatically remove expired tokens/tokens that. are no longer valid for whatever reason from. the device group, or will they just pile up and need to be removed manually (i.e. by me). Thanks!

推荐答案

据我所知,令牌过期后不会自动将其从设备组中删除.您将必须在您的应用服务器代码中执行此操作.

As far as I know tokens are not automatically removed from a device group when they expire. You will have to do that in your app server code.

如果您有旧令牌,则可以在刷新令牌后立即执行.

If you have the old token, you can do that immediately when the token is refreshed.

或者,您可以在发送消息时检测过期/过期的令牌,然后将其删除.有关此示例,请参阅此

Alternatively you can detect outdated/expired tokens when sending a message, and remove them then. For an example of this, see this code that sends messages using the Admin SDK.

这篇关于设备令牌过期后,是否会自动将其从FCM设备组中删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆