Skip to main content

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

You should use IMqttToken instead of MqttToken, and MqttTokenAndroid is used internally.

Best Regards,
Bin Zhang(张斌)
WebSphere MQ, IBM China Software Development Lab
Notes:   Bin BJ Zhang/China/IBM
E-Mail:  zhbinbj@xxxxxxxxxx
Address: Ring Building 3F, ZhongGuanCun Software Park,

DongBeiWang West Road No.8, Haidian District, Beijing, 100193, China

From:        ನಾಗೇಶ್ ಸುಬ್ರಹ್ಮಣ್ಯ (Nagesh S) <nageshblore@xxxxxxxxx>
To:        General development discussions for paho project <paho-dev@xxxxxxxxxxx>,
Date:        2014/07/18 03:46
Subject:        [paho-dev] Fwd:  Using Paho Android MQTT service.
Sent by:        paho-dev-bounces@xxxxxxxxxxx

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.

paho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top