gpt4 book ai didi

android - C2DM 的设备注册 ID 会过期吗?

转载 作者:行者123 更新时间:2023-11-30 04:32:16 25 4
gpt4 key购买 nike

嗯,我知道服务器的注册 ID 会过期。但是,设备注册 ID 呢?如果是,服务器和客户端如何知道这一点?

现在我只是将 id 保存到数据库中并假设它永远不会改变。

顺便说一句,服务器的注册 ID 是否与设备注册 ID 相关联?为什么网上的教程将它们成对存储

最佳答案

简答是肯定的,如前所述here .

The application should store this ID for later use. Note that Google may periodically refresh the registration ID, so you should design your application with the understanding that the REGISTRATION Intent may be called multiple times. Your application needs to be able to respond accordingly.

基本上必须发生的是您的应用程序需要与您的服务器进行某种通信以通知它它收到了一个新的 ID。您可以做的是,当应用程序收到注册 ID 时,将其与有关该设备的一些其他唯一信息(或用户凭据,如果应用程序具有身份验证)一起存储在某个远程数据库中。当 Google 决定更改注册 ID 时,只需使用新 ID 更新远程数据库上的先前条目。然后,当您的服务器需要向某个设备推送消息时,它会将该设备与数据库中的最新注册 ID 进行匹配,并使用该 ID 推送通知。

关于android - C2DM 的设备注册 ID 会过期吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7493715/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com