See: Description
Interface | Description |
---|---|
MessageStore |
Mechanism for persisting messages until we know they have been received
|
MessageStore.StoredMessage |
External representation of a stored message
|
MqttServiceConstants |
Various strings used to identify operations or data in the Android MQTT
service, mainly used in Intents passed between Activities and the Service.
|
MqttTraceHandler |
Interface for simple trace handling
|
Class | Description |
---|---|
AlarmPingSender |
Default ping sender implementation on Android.
|
DatabaseMessageStore |
Implementation of the
MessageStore interface, using a SQLite database |
MqttAndroidClient |
Enables an android application to communicate with an MQTT server using non-blocking methods.
|
MqttConnection |
MqttConnection holds a MqttAsyncClient {host,port,clientId} instance to perform
MQTT operations to MQTT broker.
|
MqttDeliveryTokenAndroid |
Implementation of the IMqttDeliveryToken interface for use from within the
MqttAndroidClient implementation
|
MqttService |
The android service which interfaces with an MQTT client implementation
|
MqttServiceBinder |
What the Service passes to the Activity on binding:-
a reference to the Service
the activityToken provided when the Service was started
|
MqttTokenAndroid |
Implementation of the IMqttToken interface for use from within the
MqttAndroidClient implementation
|
ParcelableMqttMessage |
A way to flow MqttMessages via Bundles/Intents
|
Enum | Description |
---|---|
MqttAndroidClient.Ack |
The Acknowledgment mode for messages received from
MqttCallback.messageArrived(String, MqttMessage) |
Status |
Enumeration representing the success or failure of an operation
|
The Android environment requires that a Service is used to support
such things as a long-lasting network connection.
This
package provides the classes need to implement such a Service to
interact with MQTT, together with an implementation of the
IMqttAsyncClient interface which uses the Service to implement the
interface operations.
The Service returns results via the Android Intent mechanism. The MqttAndroidClient class shows how the interaction is managed
Note: An App which uses this service must include the appropriate Service tag in its manifest - e.g.
‹!-- Mqtt Service --› ‹service android:name="com.ibm.android.service.MqttService" /›
Note regarding network connectivity
The service does not attempt to track network state and automatically reconnect to MQTT servers as connectivity is lost and regained
While this is clearly possible, determining appropriate behaviour presents certain challenges.
Any maintainer adding support for such functionality should look to providing a BroadcastReceiver for
ConnectivityManager.CONNECTIVITY_ACTION probably as part of the MqttService object.
Changes in network connectivity would then need to be notified to the relevant MqttConnection objects.
The behaviour in response to changes in network connectivity would need to be considered in some detail - for example :-