2013-04-18 138 views
0

我有我的数据库表指向同一个设备的多个不同deviceids因为谷歌会送我不同的设备ID,当设备重新安装/安装。由于哪些设备获得多个通知,这非常伤害我和我的用户。有没有办法告诉谷歌只发送一个通知给单个设备?或者有没有办法在发送请求之前检查id是新还是旧?任何人都会遇到这个奇怪的问题?顺便说一句,我在后端使用PushSharp/ASP.NET。从(GCM)Google通知服务器获取多个通知?

更新:我现在依赖于本地设备ID。因此,我将从我的数据库表中删除/替换原始设备ID相同的旧注册ID。

回答

1

我认为你需要,一旦你注册的错误代码从数据库中删除设备ID。

Unregistered Device 
An existing registration ID may cease to be valid in a number of scenarios, including: 
If the application manually unregisters by issuing a com.google.android.c2dm.intent.UNREGISTER intent. 
If the application is automatically unregistered, which can happen (but is not guaranteed) if the user uninstalls the application. 
If the registration ID expires. Google might decide to refresh registration IDs. 
If the application is updated but the new version does not have a broadcast receiver configured to receive com.google.android.c2dm.intent.RECEIVE intents. 
For all these cases, you should remove this registration ID from the 3rd-party server and stop using it to send messages. 
Happens when error code is NotRegistered. 

我建议你来处理错误代码,当您将消息发送到一个设备。

http://developer.android.com/google/gcm/gcm.html

请仔细阅读第三方服务器的角色。你会得到更多的细节。

+0

感谢。我想我应该使用本机设备ID来缓解这一点。 http://stackoverflow.com/questions/15744807/gcm-device-registration-issue-in-android – user2293609 2013-04-18 06:21:25