I am using mqtt paho library in my android app. It works properly until mqtt client lost connection due to network problem. Do I need to connect client manually or it has some mechanism to connect automatically.
Asked
Active
Viewed 3,241 times
1 Answers
0
you will have to register resources so that mqtt library can handle mqtt client reconnect by itself when network reconnect happens. You can check this answer, it should help.
-
Thanks for response. I am using MqttAsyncClient and it do not have registerResources. – Ali Apr 19 '16 at 07:58
-
you should be using Android Service jar rather than Java Client from paho for Android, else you will have to build few more functionalities over Java client which is already built in service jar. – Ravi Apr 19 '16 at 10:21
-
The issue has been solved by using broadcastreceiver for network change and by using connectionLost callback. – Ali Apr 20 '16 at 05:59