2013-04-18 80 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