Android Studio port of the Eclipse paho MQTT sample project.
- Download the code
git clone http://www.github.com/bytehala/android-mqtt-quickstart
- Open the project in Android Studio
- Build and run it.
To test the app, you need an MQTT broker. Luckily, HiveMQ provides a free one which we can use for testing.
After successfully connecting, you can start subscribing and publishing to topics using the app.
MQTT is a messaging protocol which has applications in the Internet of Things (IoT). This sample project uses Eclipse's open-source implementation called the Paho Project. If you go to the original source where I lifted this project from, there are non-Android sample projects that use the Paho library.
Learn more about the other MQTT options such as QOS, Last Will, etc from this really helpful 12 part series by HiveMQ http://www.hivemq.com/blog/mqtt-essentials/
(All you need is an MQTT broker)
What you want from this project are the two .jar files inside the libs/
directory.
If you want to generate your own version of these .jar files, they can be built from source using maven:
https://github.com/eclipse/paho.mqtt.java
(Honestly, when I made an MQTT app for a client, I just built on top of this sample project.)
There's an Eclipse version available here: https://github.com/eclipse/paho.mqtt.java