乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      搭建Android MQTT推送平臺

       心不留意外塵 2016-07-15

      http://blog.csdn.net/lee4755026/article/details/9699713

      2013

      最近研究了一下Android推送,在網(wǎng)上搜到了很多種方式,覺得IBM的MQTT協(xié)議這種方式還是挺不錯的。

      下面介紹一下搭建過程:

      需要準(zhǔn)備的工具如下:

      (1)、下載Mosquitto(MQTT的代理,也可以用IBM的ISMB)
      http:///download/

      我下載的是mosquitto-1.1.2-install-win32.exe,根據(jù)自己的需要下載,不安裝這個推送不了消息。
      (2)、下載AndroidPushNotificationsDemo
      https://github.com/tokudu/Androi ... /archive/master.zip

      (3)、下載PhpMQTTClient
      https://github.com/tokudu/PhpMQTTClient/archive/master.zip

      將PHPMQTTClient部署到PHP服務(wù)器上,運行,打開mosquitto安裝目錄的mosquitto.exe

       

      將以下AndroidPushNotificationsDemo的代碼根據(jù)自己的情況修改。

      1. public class PushService extends Service  
      2. {  
      3.     // this is the log tag  
      4.     public static final String      TAG = "DemoPushService";  
      5.   
      6.     // the IP address, where your MQTT broker is running.  
      7. //修改成自己的服務(wù)器地址  
      1.     private static final String     MQTT_HOST =   
      2. //          "209.124.50.174"  
      3. //          "192.168.12.19"   
      4.             "10.0.2.2"   
      5.             ;  
      6.     // the port at which the broker is running.   
      7.     private static int              MQTT_BROKER_PORT_NUM      = 1883;  
      8.     // Let's not use the MQTT persistence.  
      9.     private static MqttPersistence  MQTT_PERSISTENCE          = null;  

       

      輸入Device target ID ,內(nèi)容,點擊按鈕,OK!



      PS:

      原來其實是不需要那個PHP的,直接用mosquitto_pub.exe就可以測試了,運行客戶端程序,在命令窗口中使用Mosquitto_pub.exe -q [Qos級別] -t [主題] -m [發(fā)布的內(nèi)容] 進(jìn)行測試。這個android客戶端例子中訂閱的topic是“tokudu/你的deviceID”。


      一些別的資料:

      http://www.cnblogs.com/yjl49/archive/2012/05/17/2506819.html



       

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多