Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] About synchronous use of MqttAndroidClient

Hi Jeff, thank you so much. However I've not problem with MqttClient or MqttAsyncClient (I use the token fine on this one). My problem is using MqttAndroidClient toguether with Mqtt Android Service.

I started to create my own android service using MqttClient and MqtAsyncClient but started to use the MqttService of paho to reuse code and not to reinvent the wheel. But it is being very problematic :-(. I'm having lots of issues that I didn't have before when I was programming my own service. I'm supossing, of course, that MqttAndroidClient works fine, although I've found some of my problems in the paho android service sample app.

I'll continue investigating. Thanks again.

El 13/05/2015 00:22, "Jeff Prestes" <jeffprestes@xxxxxxxxx> escribió:
Hi Manuel,

The workaround I've created to fix this use Thread.sleep(100) to give the mobile app time to process instead of use waitForCompletion. Also, I use MqttClient instead of MqttAsyncClient and perform some isConnected checks to avoid Exceptions. 

You can try it until better solution is being built.

If you want to check an example that works for me, you can check this code out: 

I hope it might help you.

Cheers,

-Jeff Prestes

2015-05-12 19:18 GMT-03:00 Manuel Domínguez Dorado <manolodd@xxxxxxxxx>:

Than you so much Ian. I'll try to inspect the MqttAdroidClient source code myself. However if somebody has the same problem, pleas let us know.

Kindest regards.

El 13/05/2015 00:07, "Ian Craggs" <icraggs@xxxxxxxxxxxxxxxxxxxxxxx> escribió:
Hi Manuel,

I've not been able to look at the Android client yet.  I should be getting some more help soon which will enable us to answer questions such as yours.

Ian

On 05/12/2015 02:16 PM, Manuel Domínguez Dorado wrote:
Hi all,

I've benn trying to use MqttAndroidClient in a synchronous way by controlling the IMqttToken that its methods return. But each time I use:

IMqttToken.waitForCompletion(long timeout) 

the timeout expires and a MqttException is thrown. However, most of the times the operations have been done fine. Does anyone have the same problem? Is the MqttAndroidClient supposed to work as the traditional MqttAsyncClient in relation to IMqttToken handling?

Regards.
--
---
Manuel Domínguez Dorado
ingeniero ARROBA ManoloDominguez PUNTO com
http://www.ManoloDominguez.com


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top