Reputation: 1368
I am writing a MQTT client for Android. I am using ia92 library (wmqtt.jar) and trying to get messages from MQ in order to show them as android notifications. My problem is that the first time I try to connect to the MQ, my android client app successfully connects and MQ messages can be taken normally. When I switch Wi-Fi off and break the network connection, MQTT client connection drops as expected, but when I switch it on again, the app does not establish the MQ connection and throws a MQTTException, that has no error code.
mqttClient.connect(this.mqttClientId, cleanStart, keepAliveSeconds);
What can be wrong with this? I heavily need any little bit of help..
Thanks in advance
Upvotes: 2
Views: 4364
Reputation: 1097
The Java Paho Client implementation contains an Android Service Client and sample: https://github.com/eclipse/paho.mqtt.java/tree/master/org.eclipse.paho.android.service
You can also find an example of using Java Paho Client for implementing Push notifications in Android: https://github.com/dobermai/android-mqtt-push
Upvotes: 2