fredag 1. mars 2013

Quick start guide for Google Cloud Messaging

This is a guide for setting up a working Android push-messaging project. It uses the following dependencies:




Start by running the android-gcm-quickstart archetype:

 mvn archetype:generate -DarchetypeGroupId=de.akquinet.android.archetypes \   
 -DarchetypeArtifactId=android-gcm-quickstart -DarchetypeVersion=1.0.10-SNAPSHOT \   
 -DgroupId=my.project.package -DartifactId=my-project-name -DsenderId=[my-sender-id]  

Add you own project settings for groupId, artifactId and senderId. See the GCM getting started guide for information on how to get the senderId and apiKey: http://developer.android.com/google/gcm/gs.html


Configure the API Key, you can do this in three ways:

 

1. Add a property in the .m2/settings.xml file:













2. In the maven command, add a system property:
 gcmutils:run-server -DapiKey=  


3. Add the tag in the pom.xml (not recommended):




Start the test-server by running the following maven command:

 mvn gcmutils:run-server  

Open your browser on: http://localhost:9595
Start the main Android activity in the project and try to send a push message from the webpage to the connected device. By default the message should be shown by Logcat.


Now you hopefully have a working GCM project in Android!
For more detailed information, see the GCMUtils webpage

Ingen kommentarer:

Legg inn en kommentar