Paho's Android Library works fine. Its just difficult to maintain the connection state, once the app goes in background. To provide any other functionality like storing the connection options, topics to pub/sub during background state will need some rewrite at library level.
My observations :-
Once the connection is established, MqttService keeps the connection alive even if the app goes background. Unless the system's service manager kills the app & its services. All this is possible unless the network stays uninterrupted.
The service has its own Alarm Manager to keep itself alive.
I did an experiment and I have made a small solution that may help keep connection object accessible throughout the app's activities. Unless you get disconnected.
PS :- The solution is damn simple. But it just works like a charm.
https://github.com/ameykshirsagar/mqttconnectionpersistence
I am yet to make an implementation that keeps the MqttService alive even after the app's activity gets destroyed