This article link: http://blog.csdn.net/kongxx/article/details/8181196
The previous article talked about how to push the notice through the helium, below to see how to push through the gcm of Google.
Here about the GCM configuration can refer to http://developer.android.com/guide/google/gcm/demo.html
The following example assumes that the Google GCM has been configured.
1. First add Gcm.jar package to libs directory and add it to classpath.
2. First modify the Androidmanifest.xml file to add support for GCM
<manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= "Urbanairship.client" Android: Versioncode= "1" android:versionname= "1.0" > ... <!--BEGIN for Urban airship GCM--> <uses-permission Droid: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 "&
Gt ... <!--BEGIN for Urban airship GCM--> <receiver Android:namE= "Com.urbanairship.CoreReceiver"/> <receiver android:name= "Com.urbanairship.push.GCMPushReceiver" Android: permission= "Com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name= "Com.googl E.android.c2dm.intent.receive "/> <action android:name= Com.google.android.c2dm.intent.REGISTRATION"/> & Lt;category android:name= "urbanairship.client"/> </intent-filter> </receiver> <!--end for Urban Airship GCM--> ... </application> </manifest>
3. Modify the Assets/airshipconfig.properties file
3.1 Will one of the
Transport=helium
Change into
Transport = GCM
3.2 Set the Gcmsender to the Google API project ID.
4. Run the program test, send notifications from urban airship to this device, and check the status bar.