Cobub Razor GCM Push-plugin

It integrates the push function GCM provided with Cobub Razor Tag function, more convenient, fast and accurate a push.
Google GCM application of open platform to help enterprises carry out through low-cost Internet access push messages, provide a sound, efficient and stable service system to solve the Internet cloud to the phone side of the news interoperability problems.

1.Registration for Cobub User Center account

Cobub User Center is a service for mobile developer platform for mobile development process of the product life cycle process, integrating Cobub Razor platform for mobile application data, provides a series of value-added services. Mobile developers Cobub User Center can stop solve product problems encountered.

Users need to register as an official user Cobub User Center only after using GCM push plug-services.

Not registered,immediately go Cobub User Center registered.


2.Obtain authorization code and Cobub Razor authorization module for authentication

Authorization code is Cobub Razor interaction with the Cobub user secret key, the user needs to obtain the secret key in Cobub Razor account only after authorization module for authorization.

Account authorization before using Cobub User Center provides a wealth of Cobub Razor extended functionality and value added services.

Obtain authorization code and Cobub Razor authorization module for authentication


3.Register Google Account Get a Project Number and Api key

Registered Users,Get Project Number and API key, Project Number is programmed in the back when we are use to SENDER_ID.

a)Use google account login https://code.google.com/apis/console Click Services, as shown below. On Google Cloud Messaging for Android services.

payload
payload

b)Similarly, click Overview registered, we can see on the right Project Number, as shown below.

payload

c)Similarly, we click on the left you can see the API Access API key, as shown below where the red line; if you do not have API Key, you can click on the red part of the "Create new Server key ..." to create an API key.

payload

d)API key is pushed only evidence. Please log Cobub Razor, click on the left into the GCM GCM Home Enter just won API key, click Save.
payload


4 SDK 集成

一、添加jar包
1.将获取到的ums.jar和CobubGCM.jar添加到项目的libs目录。
2.在项目上右键选择Build Path->Configure build path..—>左侧选择 Java Build Path—>选择Libraries选择卡—>Add JARs.. —>选择当前项目的Libs目录,选中jar包,然后点击OK.
二、配置Androidmanifest.xml文件。
1.声明权限和服务
<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="PACKAGENAME.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PACKAGENAME.permission.C2D_MESSAGE" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Main activity. -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.cobub.gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="PACKAGENAME" />
</intent-filter>
</receiver>
<receiver
android:name="com.cobub.gcm.CobubBroadcastReceiver"
>
<intent-filter >
<action android:name="cobub.razor.message"/>
</intent-filter>
</receiver>
<?xml version="1.0" encoding="utf-8"?>
<service android:name="com.cobub.gcm.GcmIntentService" />
<meta-data android:name="UMS_APPKEY" android:value="APPKEY"/>
</application>
注意:PACKAGENAME替换为当前项目的包名.
APPKEY替换为获取到的appkey. 三、cobubGCM.jar初始化,可以在Activity的onCreate()方法中调用
CobubGCM.init(Context context,String sendID,int iconNum);
该sendID为第一幅图中的Project Nomber.
iconNum为通知的图标资源值例如:R.drawable.ic_launcher


4.View GCM Push Report

Push reports show all push APP report, click a single push of a single application APP view the report.