I am implementing the Paho MQTT Android Service within an application I am developing. After testing the sample application provided by Paho, I have found that there are a f
I know this is a late answer to this question but I would like to share what I've done as it may help someone.
I created my own Service
to manage connection to the broker and always maintain a single connected instance per android device.
Reiterating the features of the solution:
Key features of this solution:
startService(..)
again would trigger its onStartCommand()
. In this method, we simply check if this client is connected to the broker and connect/reconnect if required.Check out the fully detailed answer here.