Introduction
On android device, we often use paho mqtt client to setup mqtt client.
If you want android device to become a mqtt broker. you can use Moquette MQTT broker.
This article is about how to setup mqtt broker on android device with moqutte.
Android app settings
Following settings is not mandatory, it’s just the pre-settings of the sample app.
language: Kotlin
Steps
Add dependency
Add dependency to app build.gradle.
Sync gradle, then you might got errors such as:
Exclude them in build.gradle of app:
Start & stop server
It’s already ok for mqttBroker. If you want to make more detailed configurations, follow the next step.
Check the properties in mosquitto.conf, and set it to mqttBroker.
References
mqtt-broker-for-android
mqtt-client-library
paho mqtt client
Moquette MQTT broker
mosquitto-conf
mosquitto.conf