Question

I have multiple different deviceids in my database table pointing to same a device because google will send me different device id when a device reinstall/install. Due to which devices getting multiple notifications which is hurting me and my users very much. Is there is a way to tell google that only send one notification to single device? or is there a way to check the id is new or old before sending request? Anyone experience with this weird issue? BTW, I am using PushSharp/ASP.NET in backend.

Update: I am now relying on native device id. So, I will remove/replace the old registration ids from my database table where native device id is same.

Was it helpful?

Solution

I think you need to remove the device id from your database once you get unregistered error code.

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.

I recommend you to handle error codes when you send a message to a device.

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

Please read role of 3rd party server. You would get more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top