Maven Plugin
The gcmutils-maven-plugin provides two main features: 1. Manifest generator 1. Test server
To include the gcmutils-maven-plugin in your own project, add the following: ``` gcmutils-repo-releases http://gcmutils.googlecode.com/svn/trunk/repository/releases gcmutils-pluginrepo-releases http://gcmutils.googlecode.com/svn/trunk/repository/releases
net.jarlehansen.android.gcm.plugins gcmutils-maven-plugin LATEST_VERSION my-folder/AndroidManifest.xml true
<!-- Test server config -->
<port>8080</port> <!-- Optional -->
<contextRoot>/myServer</contextRoot> <!-- Optional -->
<!-- <apiKey></apiKey> Should be included as System property or in .m2/settings.xml -->
```
Manifest generator
One of the more error-prone and tedious tasks when creating a GCM project is to add the correct manifest entries. The GCMUtils AndroidManifest
generator is created to make this process fast and simple.
The manifest generator automatically generates the required manifest entries for a GCM app. By running either the maven plugin or the Java application, it will scan your existing AndroidManifest.xml
file and add the missing tags.
There are two main ways to use the manifest generator: * Maven plugin * Java application
Manifest generator maven plugin
Execute the following command to run the plugin:
mvn gcmutils:gcmify
Configuration values:
| manifestPath | the path to your manifest-file. Default: AndroidManifest.xml
. |
|:-----------------|:----------------------------------------------------------------|
| skipBackup | If set to true, no backup-file is created. Default: false. |
By default (the skipBackup configuration) the gcmutils-maven-plugin will automatically create a backup file, called AndroidManifest-backup.xml
. If anything wrong happens, you will still have your original AndroidManifest.xml
-file available. It is recommended to keep the backup-feature enabled, if everything is generated successfully you can delete the backup-file.
If you have a standard Android maven setup you do not need to add any configuration-options.
Manifest generator Java application
- Download the gcmutils-maven.jar from Downloads.
- To generate the manifest tags, run the command:
java -jar gcmutils-main.jar AndroidManifest.xml my.package.name
If you want to skip the creation of the backup-file, add the system property -DskipBackup=true
.
Test server
The gcmutils-maven-plugins provides a very simple test server for GCM. This makes it easy to test your application locally with a fully functional server implementation. It is also created to integrate with the GCMUtils client library.
The test server offers registration/unregistration service (storing the regIds in memory) and provides a webpage that makes it easy to send test messages to the devices.
To start the test server execute the following command:
mvn gcmutils:run-server
Configuration values:
| apiKey | The API key is created in Google APIs console and is used when sending messages to the registered devices.
It is recommended to add the apiKey value to either a system property when running the command (gcmutils:run-server -DapiKey
=) or in the .m2/settings.xml file.
See the GCM Getting Started guide for more information on how to generate the API key. |
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| port | The port number that the server will run on. Default: 9595 |
| contextRoot | The context root of the webapp. Default: "/" |
Test server webpage:
http://tinypic.com?ref=9lfnzc'>http://i49.tinypic.com/9lfnzc.png' alt='Image and video hosting by TinyPic' border='1' />