MQTT broker for Android

Does anyone know of an MQTT broker that runs on an Android smartphone? I tried Google and didn't find anything, and there seems to be only one app with 10 downloads in the app store, so I'm not sure how well it works.

+4
source share
4 answers

Add these dependencies to gradle

    dependencies{
   compile 'io.moquette:moquette-netty-parser:0.8.1'
    compile 'io.moquette:moquette-broker:0.8.1'
    compile 'io.moquette:moquette-parser-commons:0.8.1'
}

And use

io.moquette.server.Server server = new io.moquette.server.Server();
server.startServer();

to start the broker server. Default URI:tcp://localhost:1883

For me, server.startServer();gave me an exception, because it cannot create the file BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME. So, I changed the assignment BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME using this code below the code, and it worked for me.

     try {
         MemoryConfig memoryConfig = new MemoryConfig(new Properties());
memoryConfig.setProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator + BrokerConstants.DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME);
    server.startServer(memoryConfig); 
        // server.startServer();//is not working due to DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME; 
        Log.d(TAG,"Server Started");
         }
         catch (IOException e) { e.printStackTrace(); }
         catch (Exception e){ e.printStackTrace(); }

And use the Paho libraries for android

compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'

tcp://localhost:1883 .

moquette android.

+7
+1

:

Android- MQTT-

TL;DR;

, Java-, HiveMQ.

0

, , -

He has a built-in broker and a client too .. for free, connect your devices to your Android phone via an access point or Wi-Fi.

https://play.google.com/store/apps/details?id=server.com.mqtt

-1
source

All Articles