Matroska
Matroska

Reputation: 6923

C2DM: how to discover unused registrationId

which is the best practice to identify if a registrationId is actually used by the app or not? I would like to remove unused registrationIds from the 3rd party server. I cannot use username to track registrationIds because this avoids the user to use the same username on different devices and I cannot use TelephoneId because this wouldn't work on tablets. So what could it be used?

Thanks Tobia Loschiavo

Upvotes: 0

Views: 177

Answers (2)

mseo
mseo

Reputation: 3911

You have to send a push message to see if the RegistrationID is still in use.

have a look at http://code.google.com/intl/de/android/c2dm/#push

There's a section for the error code:

Error=[error code]

NotRegistered — The user has uninstalled the application or turned off notifications. Sender should stop sending messages to this device and delete the registration_id. The client needs to re-register with the c2dm servers to receive notifications again.

So you can delete the RegistrationID if you get this NotRegistered Error Code when sending a notification.

Upvotes: 1

Peter Knego
Peter Knego

Reputation: 80340

When app wants to start receiving notifications it sends the RegistrationId to server.

When app wants to stop receiving notifications (at least when it's uninstalled) it again notifies server and includes it's RegistrationId, so that server can delete it drom database.

Upvotes: 0

Related Questions