gpt4 book ai didi

android - 没有针对已卸载的 registration_id 的 NotRegistered 消息

转载 作者:太空狗 更新时间:2023-10-29 12:47:07 25 4
gpt4 key购买 nike

我使用以下方式获得了注册 ID:

String regid = (GoogleCloudMessaging.getInstance(this)).register("My_Sender_ID");

并将其存储在我服务器上的数据库中。稍后当应用程序被卸载并且我尝试发送一条消息时,我预计会收到一条 NotRegistered 错误消息,查看它我将从数据库中删除相应的 ID。

但问题是它仍然像任何其他成功案例一样返回一个message_id。我想再测试一段时间,等了一个小时,现在我收到了正确的消息。

[error] => NotRegistered

那么,这种延迟是预期的吗?

谢谢

最佳答案

是的,这种延迟是意料之中的。

在卸载您的应用程序后第一次尝试发送消息时,GCM 服务器尝试将其发送到设备并发现您的应用程序不再在该设备上注册 GCM。

在卸载后第二次尝试发送消息时,您收到了 NotRegistered 错误,因为这次 GCM 服务器知道此注册 ID 不再注册。

您无需等待一个小时即可再次尝试发送。

Note: When users uninstall an application, it is not automatically unregistered on GCM. It is only unregistered when the GCM server tries to send a message to the device and the device answers that the application is uninstalled or it does not have a broadcast receiver configured to receive com.google.android.c2dm.intent.RECEIVE intents. At that point, your server should mark the device as unregistered (the server will receive a NotRegistered error).

(引自here)

关于android - 没有针对已卸载的 registration_id 的 NotRegistered 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16942973/

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