I am trying to write an application which notifies a cellphone using GCM. I was able to implement basic functionality, but there is one question I’m still unsure of
As I understand, the flow goes like this:
- Device start up
- Device registers, obtains registration id
- Server gets the knowledge of registration id on device
- Server is using it’s API key + registration id to send payload to device
- Device receives payload.
One thing which is unclear to me is: what is a proper methodology to implement step #3?
I could not find any way to obtain a list of registered devices. Lets imagine, I am using GCM for a purpose of posting to a known device, and I could email that ID to myself and then register it on the server manually. But as I understand, it expires.
So, it there an expectation that I have to keep re-registering and somehow notifying server every time it happens?
Yes, your app on device must send registration ID to your server application in order for server to be able to send GCM messages. See third point in Enabling GCM.