Urban airship Android Client-google GCM Push

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.