91嫩草国内在线,韩国理论电影免费看,6969精品视频在线观看,1024在线视频精品免费,色中色污,饭冈佳奈子在线
跳至內(nèi)容
Cobub文檔中心
用戶工具
登錄
站點(diǎn)工具
工具
顯示頁(yè)面
修訂記錄
反向鏈接
媒體管理器
網(wǎng)站地圖
登錄
媒體管理器
網(wǎng)站地圖
本頁(yè)面只讀。您可以查看源文件,但不能更改它。如果您覺(jué)得這是系統(tǒng)錯(cuò)誤,請(qǐng)聯(lián)系管理員。
====== HuaweiPush Plugin ====== Huawei Push the plug is Cobub Razor official platform based Huawei alliance to push the development of a plug-in. It integrates features a push function Tag Huawei and Cobub Razor Alliance platform provides more convenient, fast and accurate a push. Huawei Union open platform for messaging applications to help companies push through low-cost Internet access, provide a sound, efficient and stable service system solves the Internet cloud to the phone side of the message interoperability problems. ===== Integration steps: =====I Huawei push the plug before integration, ensure the establishment of a database related tables, can go to[[razor:plugins:start|here]]sql file Download related to import into your database, create a related table (note changes in the prefix table sql razor_, in order to maintain your own database table prefix and consistent). ** 1.**Ensure Cobub Razor and Cobub authorized users Center has successfully bound.** If not binding, see [[razor:plugins:start|here]]. **2.Activate Huawei Cobub Razor in push applications ** 若要使用華為推送插件中的推送,系統(tǒng)需要為每個(gè)App(當(dāng)前只支持Android平臺(tái))分配相應(yīng)的授權(quán)Key。 **3.華為推送SDK集成** 在華為聯(lián)盟下載下來(lái)的華為推送SDK為.rar文件,在本地解壓后,進(jìn)入“微內(nèi)核SDK\Doc”目錄,參考Doc目錄下的《華為PushSDK集成說(shuō)明.pdf》文檔集成華為推送SDK 集成步驟: ==== 3.1.集成jar包: ==== 將獲取到的cobub razor的ums.jar添加到華為推送項(xiàng)目的libs目錄。 在項(xiàng)目上右鍵選擇Build Path->Configure build path…—>左側(cè)選擇 Java Build Path—>;選擇Libraries選擇卡—>;Add JARs.. —>;選擇當(dāng)前項(xiàng)目的Libs目錄,選中jar包,然后點(diǎn)擊OK. ==== 3.2.修改華為推送SDK項(xiàng)目包名與您創(chuàng)建應(yīng)用的包名相一致 ==== ==== 3.3.配置AndroidManifest.xml文件。 ==== * 添加授權(quán) <code> uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" uses-permission android:name="com.android.mylauncher.permission.INSTALL_SHORTCUT"</code> * 加入服務(wù)聲明 <code> meta-data android:name="UMS_APPKEY" android:value="APPKEY" meta-data </code> 注意:PACKAGENAME替換為項(xiàng)目包名. 其中的APPKEY是通過(guò)Cobub razor創(chuàng)建應(yīng)用時(shí)獲取到的 ==== 3.4 添加SendMapping.java映射文件:將SendMapping.java文件放在’..\src\項(xiàng)目名’目錄下 ==== <code> package PACKAGENAME; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.util.Log; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.protocol.HTTP; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import com.wbtech.ums.UmsAgent; import com.wbtech.ums.common.CommonUtil; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; public class SendMapping extends BroadcastReceiver { public static String NAME = "BroadcastReceiver2SendMapping"; boolean isGetCobubBroadcoast = false; boolean isGetHuaWeiBroadcoast = false; String serviceURL = "http://push.cobub.com/index.php?/api/huawei/postmapping"; public SendMapping() { } @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Log.d(NAME,"SendMapping onReceive"); //注冊(cè) receiver // SendMapping receiver = new SendMapping(); // IntentFilter filter = new IntentFilter(); // filter.addAction("cobub.razor.message"); // filter.addAction("com.huawei.android.push.intent.REGISTRATION"); // registerReceiver(receiver, filter); String action = intent.getAction(); SharedPreferences sp= context.getSharedPreferences("cobub_huawei_sharepreference", 0); if(action.equals("cobub.razor.message")){ String deviceid = intent.getStringExtra("deviceid"); Log.d("postdata ", "get deviceid : "+deviceid); sp.edit().putString("deviceid", deviceid).commit(); isGetCobubBroadcoast = true; } if(action.equals("com.huawei.android.push.intent.REGISTRATION")){ String deviceToken; try { deviceToken = new String(intent.getByteArrayExtra("device_token"), "UTF-8"); sp.edit().putString("deviceToken", deviceToken).commit(); Log.d("postdata ", "get deviceToken : "+deviceToken); isGetHuaWeiBroadcoast = true; } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(isGetCobubBroadcoast&& isGetHuaWeiBroadcoast){ final JSONObject obj = new JSONObject(); String deviceid = sp.getString("deviceid", ""); String deviceToken = sp.getString("deviceToken", ""); try { obj.put("deviceToken", deviceToken); obj.put("deviceid", deviceid); obj.put("app_key", CommonUtil.getAppKey(context)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.d("postdata ", "post deviceid and deviceToken"); new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub post(serviceURL,obj.toString()); isGetCobubBroadcoast = false; isGetHuaWeiBroadcoast = false; } }).start(); } } public static int post(String url, String data) { String returnContent = ""; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); Log.d("postdata", "SMpost"+url+" "+data); try { StringEntity se = new StringEntity("content="+data, HTTP.UTF_8); se.setContentType("application/x-www-form-urlencoded"); httppost.setEntity(se); HttpResponse response = httpclient.execute(httppost); int status = response.getStatusLine().getStatusCode(); Log.d("postdata ", "status==="+status); String returnXML = EntityUtils.toString(response.getEntity()); returnContent = URLDecoder.decode(returnXML); switch (status) { case 200: { Log.d("postdata ", "status===200"); JSONObject obj = new JSONObject(returnContent); return obj.getInt("flag"); } default: Log.d("postdata ", "status="+status); break; } } catch (Exception e) { e.printStackTrace(); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("err", e.toString()); returnContent = jsonObject.toString(); } catch (JSONException e1) { e1.printStackTrace(); } } Log.d("postdata ", "post deviceid error deviceToken"); return 0; } } </code> ==== 3.5. 初始化SDK ==== 在您應(yīng)用程序主Activity里導(dǎo)入 UmsAgent; <code> import com.wbtech.ums.UmsAgent;</code> 然后在您應(yīng)用程序啟動(dòng)初始化階段,初始化SDK: <code> UmsAgent.setBaseURL("http://192.168.1.104:80/dev07/razor/web/index.php?"); UmsAgent.update(this); UmsAgent.onError(this); UmsAgent.setDefaultReportPolicy(this, 1); UmsAgent.bindUserIdentifier(this, "xd.."); UmsAgent.postClientData(this); //注冊(cè) receiver SendMapping receiver = new SendMapping(); IntentFilter filter = new IntentFilter(); filter.addAction("cobub.razor.message"); filter.addAction("com.huawei.android.push.intent.REGISTRATION"); registerReceiver(receiver, filter); </code> 該方法必須在Activity或Service類(lèi)內(nèi)調(diào)用。一般情況下,可以在Activity的onCreate()方法中調(diào)用 為保證意外情況導(dǎo)致初始化失敗,建議應(yīng)用程序每次啟動(dòng)時(shí)都調(diào)用一次該初始化接口。 ===== 4.使用華為推送服務(wù) ===== 進(jìn)入Cobub Razor插件華為推送首頁(yè),插件會(huì)讀取所有當(dāng)前系統(tǒng)中的Android應(yīng)用列表。 在每個(gè)應(yīng)用后都有推送操作,用戶可以根據(jù)自身需要進(jìn)行選擇消息類(lèi)型。 進(jìn)入推送詳細(xì)界面,根據(jù)要求選擇標(biāo)簽或者整個(gè)APP推送,填寫(xiě)相關(guān)內(nèi)容并進(jìn)行推送 ===== 5.查看個(gè)推推送報(bào)告 ===== 進(jìn)入插件中的推送報(bào)告模塊,用戶可以查看用戶推送的報(bào)告。注:系統(tǒng)只支持30日內(nèi)推送報(bào)告查詢服務(wù)。用戶可通過(guò)右上角選擇時(shí)間段。 推送報(bào)告顯示了所有激活的APP的推送報(bào)告,點(diǎn)擊單個(gè)APP查看單個(gè)應(yīng)用的推送報(bào)告。 ===== 6.賬戶與結(jié)算 ===== 華為推送插件按月結(jié)算,系統(tǒng)會(huì)每個(gè)月根據(jù)用戶上個(gè)月的用戶所有APP在線用戶總數(shù)來(lái)進(jìn)行結(jié)算。 華為推送插件的收費(fèi)是按照當(dāng)月在線人數(shù)結(jié)算,與推送次數(shù)無(wú)關(guān)。 為保證推送服務(wù)正常進(jìn)行,請(qǐng)到個(gè)人中心賬戶充值模塊預(yù)先充值。 ===== 7.常見(jiàn)問(wèn)題 ===== 如何獲取Package Name? 應(yīng)用標(biāo)識(shí)(Package Name),常以com開(kāi)頭 方法: * 手機(jī)上打開(kāi)你的應(yīng)用 * 點(diǎn)擊設(shè)置 ->; 應(yīng)用程序 ->; 管理應(yīng)用程序 ->; 正在運(yùn)行,在列表中找到你的程序 * 在進(jìn)程中可以看到應(yīng)用的應(yīng)用標(biāo)識(shí)(Package Name)
en/razor/plugins/huaweipush.1426737126.txt.gz
· 最后更改: 2017/07/14 11:12 (外部編輯)
頁(yè)面工具
顯示頁(yè)面
修訂記錄
反向鏈接
回到頂部
? Copyright 2012 - 2015
南京西橋科技有限公司
Western Bridge Tech Co., Ltd.
蘇ICP備13039116號(hào)-1