Following zip contains both GCM Client and GCM Server sample implementation
------------------------------------------------------------------
How to run GCM Server
--------------------
1)Add Apache Tomcat Runtime environment installation in eclipse
1.1)Go to help --->Install new software
1.2)Select or add "http://download.eclipse.org/releases/galileo"
1.3)Check the following: “JST Server Adapters” (there are two)
Now the adapters are installed, but not configured. Configuration is like this:
2) Go to: Eclipse -> Preferences
3) Select: Server -> Runtime Environment
4) Click: “Add…”
5) Select: Apache -> Apache Tomcat v6.0 (or choose the version you need)
Add J2EE tools to the Eclipse
------------------------------------
Go to Help->Install New Software.
In the dropdown, select 'Juno - http://download.eclipse.org/releases/juno '
Expand 'Web, XML, Java EE, and OSGI Enterprise Development'
Check the box for 'Eclipse Java EE Developer Tools'
After the above two steps are done
1)Create new dynamic project in eclipse and copy paste above files present in the GCMServer
2)Start the Tomcat server by selecting windows--->ShowView--->servers
3)Server tab will be opened below then add new wizard and set up the tomcat
4)Right click on the server and set its location to the downloaded tomcat directory
5)Double
click on the server overview page will be opened where click on
openlaunchconfiguration and go to class path and add tomcatjuli.jar to
user Entries which is present in bin of the downloaded tomcat
6)Specify server location as "Use Tomcat Installation"
7)Save and start the server
8)Go to browswer and type the following address "http://localhost:8080/GCMService/index.jsp"
9)Click on submit
Following keys should be entered in the GCM Server
------------------------------------------------
1)Device token which is obtained when we run GCM Client on the Phone
private
static final String DROID_BIONIC =
"APA91bE0HSlPYPbF7Rd9tmrCWKS4yqiFx5WX6sFjxKeP3eKR2iXuae9Fbm_UzEt4HC3PWGaicGsJjkUAepAIImimv3HOPGX8zI1EYDwuivXu1rTiUY1t-9KIULoMzf75OIqM-zOXbEF0-hf8P14XqqbyzNOoS_EtaTO96VVzDM5id0bCXt2qZmo";
2)Key for Server Applications which can be taken from google console page
private static final String SENDER_ID = "AIzaSyAJYd7DLJr3Voazx_cEBEPtkjhet_znx_9";
Following keys should be entered in GCM Client
------------------------------------------------------
1)Project ID
senderID = "858139312320"
Client and Server Example