Android:Google FCM 规范 ID - 如何在非生产或测试中重现
Android: Google FCM canonical ids -how to reproduce in non production or tests
我正在尝试编写测试用例来验证规范 ID 是否在没有模拟的情况下成功替换了原始令牌。
我无法从 android 设备重现此内容。我尝试发送带有旧注册 ID 的推送通知,但我只是从 FCM 收到 NotRegistered。
关于如何复制有什么建议吗?
AFAIK,您不再需要使用 Canonical ID(尽管让您的 server/client 能够处理它们会很好)。自从 FCM 出现以来,我就再也没有看到过使用规范 ID。
我回答的一部分:
In FCM, it seems the Canonical IDs are no longer used (or at the very least extremely rarely) because of how the Instance ID service works. To put it simply, the service works that there would only be one valid token per App Instance.
If the older token expires (for whichever reason), FCM triggers a tokenRefresh event where you would get a new registration token, and where you must also handle it accordingly (in onTokenRefresh()
).
我正在尝试编写测试用例来验证规范 ID 是否在没有模拟的情况下成功替换了原始令牌。
我无法从 android 设备重现此内容。我尝试发送带有旧注册 ID 的推送通知,但我只是从 FCM 收到 NotRegistered。
关于如何复制有什么建议吗?
AFAIK,您不再需要使用 Canonical ID(尽管让您的 server/client 能够处理它们会很好)。自从 FCM 出现以来,我就再也没有看到过使用规范 ID。
我回答的一部分
In FCM, it seems the Canonical IDs are no longer used (or at the very least extremely rarely) because of how the Instance ID service works. To put it simply, the service works that there would only be one valid token per App Instance.
If the older token expires (for whichever reason), FCM triggers a tokenRefresh event where you would get a new registration token, and where you must also handle it accordingly (in
onTokenRefresh()
).