Registration Certificate Identification for GCM

We have an application that uses GCM. When the user first opens the application, the application checks the general settings to see if the user is previously registered. If the registration ID is not taken from GCM and is not stored in general preferences. There is also a third-party server that stores user IDs and registration IDs. I read and executed the following cases for canonical errors:

  • When sending a notification, if a new registration identifier (canonical identifier) ​​is received, the old registration identifier is updated with the canonical identifier on the third-party server.
  • When the user uninstalls the application and when the third-party server sends a notification about the removal of the application registration identifier, an unregistered message is not registered, and the registration identifier is deleted from the third-party database.

As a developer, we have many registration identifiers stored in the database. Because we often uninstall and install the application. Usually the user will not do this. Then we looked at using the device identifier as a unique identifier for the device and checking whether the user was previously registered. Can I use the Android device id for this? What should I consider to prevent multiple registration identifiers for a device? These multiple registration identifiers cause multiple taps on the Android device. Multiple registration identifiers are mainly caused by:

  • The application has been recently uninstalled and reinstalled. How can I detect that a user has been deleted and installed and already has a login ID?
  • The cache has been cleared and / or data has been deleted for the application recently. How can I detect that the user has cleared the application data and already has a registration identifier?

What is the best practice for handling canonical identifiers?

+6
android canonical-link google-cloud-messaging
source share
1 answer

To cope with the situation where the user uninstalled and reinstalled the application (or cleared the application data), I would save the user ID (or some identifier that you use to identify the application instance on a specific device) to the device’s external storage. This storage will not be destroyed if the user deletes the application or clears the application data (it can still be deleted manually by the user, but there is nothing you can do about it).

Then, when you launch the application, if user data is not available in the general settings, you try to restore it from external storage. If this is not available in external storage, you assume that this is a new application installation on a new device and registration in GCM (in addition, you are also advised to re-register with GCM whenever a new version of your application is installed).

And if all this client-side processing fails, you still get the option to remove duplicate registration IDs from the server, whenever you get a canonical registration ID in a response from Google.

+2
source share

All Articles