Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Fwd: Using Paho Android MQTT service.

One point about the tokens to track the completion of the asynchronous connection.

When I use
MqttToken tok = c.connect()

the application fails at runtime with a message as MqttTokenAndroid cannot be cast to MqttToken. So, I wanted to change to

MqttTokenAndroid tok = c.connect().

This wouldn't work because Eclipse wouldn't recognise MqttTokenAndroid even with the correct service JAR in place. I saw that MqttTokenAndroid class does not have access modifier. I changed MqttTokenAndroid to public class and then Eclipse recognised it.

Subsequently, in a AsyncTask, I added the code to wait for completion using MqttTokenAndroid token and now it works.


Back to the top