How can I make the server and a client pair up?
I have a server which sends messages using Google Cloud Messaging.
I also have a client on Android which has an app ready to receive.
But i need to get the device id from the client and give it to the server. Is there any other way to pair up the devices?
I want to connect multiple devices to the same server, it this possible?
Thanks
You can send the GCM registration id from device to server using a HTTP call along with a device ID (ANDROID_ID or IMEI).
Server can persist the mapping between device and its GCM registration id.
While sending the GCM from server: use GCM regId, server key and project id.
In your first Activity:
In your GCMIntentService class:
Yes, it is possible to pair different devices with a server. We have paired up few hundred devices with our server.
Edit:
Device call following URL from code:
http://www.example.com/updateGcm?id=&gcmId=
Server simply saves/updates the mapping in a database table.
I am afraid I can’t provide exact server side code.
We are using a PHP server (not using the jar provided for server)