0
votes

I m planning to build an android app the specification of this app is:

1) it should have this ability to send data suach as (new record in database) to the server 2) server also should able to send data or some information to the specific or all android devices

i dont know should all the android-side user register to GCM or not? if all the user should register to the gcm it is maybe difficult for some people!!!

please give me step by step process about gcm

from client side and server side

2
Read the sample code that comes with the SDK. - NickT

2 Answers

1
votes

You should implement GCM if you need the ability to push information to device and it would be too costly to implement polling. The guide for GCM integration is quite good: http://developer.android.com/google/gcm/index.html and also all the boiler code can be created for you by saying New GCM enabled Android app.

0
votes

I have done something similar:

  1. Yes all users should have GCM implemented (but this does not require user interaction)
  2. The GCM framework gives each device a unique registration id. Store this id together with other user information on server database.
  3. When server receives a message from say user A with registration id 12345, who wishes to send the message to user B and C.
  4. Now it is easy for the server to look up user B and C and their registration I'd forward the message, possibly adding the information that it came from A.