The following example assumes that Google's GCM has been configured.
1. First add the gcm. jar package to the libs directory and add it to the classpath.
2. First modify the AndroidManifest. xml file to add support for GCM.
[Html]
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = "urbanairship. client"
Android: versionCode = "1"
Android: versionName = "1.0" type = "codeph" text = "/codeph">
...
<! -- BEGIN for Urban Airship GCM -->
<Uses-permission android: name = "android. permission. GET_ACCOUNTS"/>
<Uses-permission android: name = "android. permission. WAKE_LOCK"/>
<Uses-permission android: name = "com. google. android. c2dm. permission. RECEIVE"/>
<Uses-permission android: name = "urbanairship. client. permission. C2D_MESSAGE"/>
<Permission android: name = "urbanairship. client. permission. C2D_MESSAGE" android: protectionLevel = "signature"/>
<! -- END for Urban Airship GCM -->
<Application
Android: name = "urbanairship. client. MyApplication"
Android: enabled = "true"
Android: icon = "@ drawable/ic_launcher"
Android: label = "@ string/app_name"
Android: theme = "@ style/AppTheme"
Android: debuggable = "true">
...
<! -- BEGIN for Urban Airship GCM -->
<Cycler android: name = "com. urbanairship. CoreReceiver"/>
<Cycler
Android: name = "com. urbanairship. push. GCMPushReceiver"
Android: permission = "com. google. android. c2dm. permission. SEND">
<Intent-filter>
<Action android: name = "com. google. android. c2dm. intent. RECEIVE"/>
<Action android: name = "com. google. android. c2dm. intent. REGISTRATION"/>
<Category android: name = "urbanairship. client"/>
</Intent-filter>
</Cycler>
<! -- END for Urban Airship GCM -->
...
</Application>
</Manifest>
3. Modify the assets/airshipconfig. properties file.
3.1 place
[Plain]
Transport = helium
Change
[Plain]
Transport = gcm
3.2 set gcmSender to the Google API project ID.
4. Run the program test, send a notification from Urban AirShip to this device, and then check the status bar.