Answer the question
In order to leave comments, you need to log in
Android: How to update deviceId in GCM?
Hello!
As you know, deviceId, which is issued to a device for working with Google Cloud Messaging, periodically goes out.
Actually, the question is: how to update this deviceId without starting the application? So that the server can send a push notification to an application that has not been launched for a long time.
The first thought is to start a service that will periodically receive its deviceId in the background and send it to the server when it changes. Maybe there is a better solution?
Answer the question
In order to leave comments, you need to log in
Use an XMPP server. In this case, it will automatically return you a new registration_id when you try to send a message with the old one.
See documentation
According to the new guides, you need to register a receiver that will start the service for updating, if everything is in order with the play services, they will cause the token to be updated when GCM needs it. And as far as I remember, it is not deviceId that is issued at all, but a derivative of it at the discretion of GCM'a.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question