This library was made based on MQTT Protocol
Installation instructions:
- Copy the .xml and .jar(s) files to your custom libraries folder
- Select in your REFERENCED LIBRARIES
Version history:
V1.0.0 (First public release - Donationware):
- Initial version
V1.0.2 (Release - Donationware):
- Implement method to get independence of threads
V1.0.4 (Release - Donationware):
- Implement method to subscribe a topic with QoS
V1.0.5 (Release - Donationware):
- Now can be used isConnected method "BEFORE" the first connection
V1.0.6 (Release - Donationware):
- not published
V1.0.7 (Release - Donationware):
- New methods: Publish2, Subscribe3, Subscribe4
This new methods return the token, then after when arrived or publish the messages, you can compare
MQTT
Author: Alberto Iglesias - [email protected]
Version: 1.07
- MQTT
Events:- connectionlost ( )
- deliverycomplete (Token As String)
- messageArrived (Topic As String, Message As String)
- onConnect (Status as boolean As )
- onDisconnect (Status as boolean As )
- onInitialized ( )
- CleanSession As Boolean
- JavaDebug As Boolean
- KeepAliveInterval As Int
- QoS_AtLeastOnce As Int
- QoS_AtMostOnce As Int
- QoS_ExactlyOnce As Int
- generatedClientId As String
- About As String
- Connect (broker As String, ClientID As String, Username As String, Password As String) As Boolean
- Disconnect As Boolean
- Initialize (eventname As String)
- Publish (Topic As String, Message As String, Qos As Int, Retained As Boolean)
- Publish2 (Topic AsString, Message AsString, Qos AsInt, Retained AsBoolean)
- Subscribe (Topic As String)
- Subscribe2 (Topic As String, QoS as int)
- Subscribe3 (Topic As String)
- Subscribe4 (Topic As String, QoS as int))
- Unsubscribe (Topic As String)
- Version As String
- isConnected As Boolean
- android.permission.ACCESS_WIFI_STATE
- android.permission.INTERNET
How works the MQTT protocol
Communication Infrastructure
References:
http://mqtt.org/
http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
Mosquitto Broker: http://mosquitto.org/
* This version is fully functional, the only one difference is when publishing a message the text "Donationware" is delivery with your message.
Please consider a simple €10 donation and I send to you the Library without "Donationware" text in a publish method.
Already available in B4J too:
https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4j.48184/
Already available in B4i too:
https://www.b4x.com/android/forum/threads/mqtt-mq-telemetry-transport-for-b4i.50036/
Attachments
-
MQTTB4ASample.zip7.8 KB · Views: 933
-
MQTT Library1.0.2.zip162 KB · Views: 643
-
MQTTSampleActivity.zip8.2 KB · Views: 763
-
SampleSubscribe2.zip8.3 KB · Views: 727
-
MQTT Library1.0.4.zip154.6 KB · Views: 550
-
MQTT Library1.0.5.zip154.9 KB · Views: 575
-
SampleIsConnected.zip8.3 KB · Views: 818
-
SampleWithToken.zip8.2 KB · Views: 572
-
MQTT Library1.0.7.zip155.6 KB · Views: 1,004
Last edited: