Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] How to reconnect MqttAndroidClient in poor network conditions

Hi,
 
You might want to check out this super simple example of how to use the Android service (https://github.com/jpwsutton/PahoAndroidSample/blob/master/app/src/main/java/paho/mqtt/java/pahoandroidsample/MainActivity.java). By the looks of your code it will be a lot easier to use this than using the bundled sample app as an example. 
 
The existing sample app should really be renamed to demo or something like that as it's actually a very complicated use of the Android service and isn't the best example for anyone starting out, sorry about that! Hopefully I'll get a chance to put a proper example in soon!
 
Kind regards,
 
James Sutton
Software Engineer - IoT Foundation - MQTT Open Source Projects
Technical Trojan - Wimbledon Project

Phone: 01962 815438 | Extension: x372454
E-mail: 
Personal Website: www.jsutton.co.uk
Find me on:      
IBM

Hursley Park
HursleySO212JN
United Kingdom
 
IBM United Kingdom Limited Registered in England and Wales with number 741598 Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
 
 
----- Original message -----
From: "zhangkai.gis"<zhangkai.gis@xxxxxxx>
Sent by: paho-dev-bounces@xxxxxxxxxxx
To: "paho-dev"<paho-dev@xxxxxxxxxxx>
Cc:
Subject: [paho-dev] How to reconnect MqttAndroidClient in poor network conditions
Date: Wed, Feb 24, 2016 12:33 PM
 
Hello,
I use MqttAndroidClient in my app.I reconnect the mqtt(test.mosquitto.org) in the IMqttActionListener's OnFailure function.I  set cleanSession to false.I set timeout value 30 seconds.after the first timeout I add 10 seconds.The max value is 300 seconds.But it is hard to connect to the broker.Do you have some recommanded way to reconnect to the server.How to use MqttConnection.reconnect()?My code https://github.com/GisKook/gpstracker
 
2016-02-24

zhangkai.gis
_______________________________________________
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
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


Back to the top