Basic Steps for Using MQTT in android

后端 未结 3 825
执念已碎
执念已碎 2020-12-02 04:13

I am new to Android and want to use MQTT as push notifier for Android from Server.
i have read about MQTT but does not understand well.

3条回答
  •  Happy的楠姐
    2020-12-02 04:29

    Basic Steps

    1. Install the WAMP server with PHP (the version should be upper than 5.1.0)
    2. As the WAMP server is installed, start the WAMP server(so that it can get default configuration).
    3. Open command prompt and change the directory to the PHP{version},

    For Ex. Cd C:\wamp\bin\php\php5.3.0

    [1] Install PEAR

    • Now we have to install the PHP PEAR (i.e. not installed by default) by running the command below.

      php -d phar.require_hash=0 ./PEAR/go-pear.phar

      OR

      php -d phar.require_hash=0 go-pear.phar

    • Now check the directory PEAR under C:\wamp\bin\php\php5.3.0\PEAR (Installed or Not).

    • Now in the Directory C:\wamp\bin\php\php5.3.0 there is PEAR_ENV.reg (Registry File) is create, so double click on that to change PHP.ini file with PEAR invironment

    • Now as pear is installed we have to run the following commands (Optional).

      pear upgrade

      pear install upgrade-channels

      So the PEAR setup is now completed

    [2] Install SAM (Simple Asynchronous Messaging)

    • To install SAM we have to Run the Following Command

      Goto C:\wamp\bin\php\php5.3.0

      Pecl install –B SAM

    [3] Choose and Run Mosquitto or RSBM

    • Really Small Message Broker (RSMB) is a simple MQTT broker also provided by IBM http://www.alphaworks.ibm.com/tech/rsmb. It runs on port 1883 by default. In our architecture it accepts messages from the server and passes them on to the right devices. RSMB can also be replaced by the Mosquitto server http://mosquitto.atchoo.org/
    • lets go with the RSMB.
    • Download and goto Windows folder in rsmb ( your version )
    • Start Broker.exe

    NOW YOUR SERVER IS CONFIGURED. YOU CAN USE IT FOR PUSH NOTIFICATION.

提交回复
热议问题