流式细胞仪 |多个发件人 ID [英] FCM | Multiple Sender ID

本文介绍了流式细胞仪 |多个发件人 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 GCM 迁移到 FCM.

在 GCM 中,我们可以为多个发件人 ID 调用 getToken() 方法,如下所示:

In GCM, we can call getToken() method for multiple sender ids as below:

String senderIds = "112233445566,889922338899";
String token = instanceID.getToken(senderIds,
                        GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);

Q1 - 进入 FCM 后,它会保持不变还是我需要进行任何更改才能获取多个发件人 ID 的令牌?

Q1 - After moving into FCM, will it remain same or I need to make any changes in order to get the token for multiple sender ids?

来自 这个 参考,我知道我可以为每个发件人 ID 调用 getToken("senderIds1", "FCM"),但我希望在进入 FCM 时进行最少的代码更改.

From this reference, I know that I can call getToken("senderIds1", "FCM") for each sender Id, but I want minimum code changes while moving into FCM.

Q2 下面将适用于 FCM(与 GCM 相同),否则我必须调用 getToken("senderIds1", "FCM");getToken("senderIds2", "FCM")?

Q2 Will below work for FCM (same like GCM) or I have to call getToken("senderIds1", "FCM"); getToken("senderIds2", "FCM")?

getToken("senderIds1, senderIds2", "FCM") 

推荐答案

更多地了解这个功能——扫描文档和查看旧帖子——我决定更新这个答案.由于行为本身在 FCM 正式发布之前就已经存在,因此服务中(幕后)已经更新了很多东西(有些已弃用).这方面的一个例子是回到 C2DM 到 GCM 迁移,令牌所在的部分'不可互操作被声明.

Looking more into this function -- scanning the documents and viewing old posts -- I've decided to update this answer. Since the behavior itself existed way before FCM was officially released, a lot of things have already been updated (some deprecated) in the service (under the hood). An example of this is going way back to C2DM to GCM migration, the part where the tokens weren't interoperable was stated.

对于通过传递逗号分隔的 senderIds 来使用 getToken(),由于没有记录或在任何官方 FCM 文档或声明中建议/提及它,最好避免使用它们,而是继续执行官方程序 - 通过使用 getToken("senderId", "scope") for each 发件人并将这些令牌中的每一个维护为需要.

For using getToken() by passing comma-separated senderIds, seeing as it is not documented or is advised/mentioned in any official FCM documentation or statements, it is best to avoid using them and instead proceed with the official procedure -- by using getToken("senderId", "scope") for each sender and maintaining each of those tokens as needed.

通过传递逗号分隔的 senderIds 来选择仍然使用 getToken() 将来可能会产生意外的行为,因此我强烈建议开发人员继续执行重复帖子中建议的程序.

Choosing to still use getToken() by passing comma-separated senderIds may probably produce unexpected behaviors in the future, so I strongly encourage developers to proceed with the suggested procedure in the duplicate post.

这篇关于流式细胞仪 |多个发件人 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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