Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Getting started with Android and the Android Service

Hello Gustav,

I use the plain paho client on android wrapped in my own Service, just like any other library that needs to do work off the main thread. I think this is the best way, especially if it happens that the Service must contain more than just the paho client.

Writing your own service also allows you to tailor how the messages are persisted, and how this is communicated back to the UI. Both are these are common design decisions for anyone using Services on Android.

Its no different than using any other networking library. In my case, the paho client persists messages to the ContentProvider and the UI uses a ContentObserver to see whats going on.

I have also wrapped the client in rxjava and that worked very nicely too.


From: gustav.sohtell@xxxxxxxxxxxxxxxxxxxx
Date: Wed, 18 Jun 2014 16:26:54 +0200
To: paho-dev@xxxxxxxxxxx
Subject: [paho-dev] Getting started with Android and the Android Service


I’m trying to get the Android Service into my Android project. It is an standard Android Studio Android Project so it is using Gradle. The best solution would be if I could in some way get the jars into my project via Gradle (maven or Ivy). Does anyone know how to do that? 
I have found the MQTT-client here: but I can’t find the Android Service and I can’t seem to get the first one into Gradle anyway.

Next best solution would be to find a jar of the Android Service. I can use the mqtt-client jar from the link above but the Android Service is more difficult to get. I tried using the download-link on the page but that link is a tricky one since the link doesn’t really go anywhere but to the page itself. :)

So then I tried building the Android Service myself from source. Apart from the problem that I can’t open folders ending in .service in OSX (it is interpreted as some kind of system folder which can’t be opened) I can’t get it to compile. I did manage to get the MQTT-client-jar into the project and that resulted in fewer compilation errors but it still complains about not being able to find e.g. MqttPingSender. Anyone knows how to resolve those issues? 

Best regards,
_______________________________________________ paho-dev mailing list paho-dev@xxxxxxxxxxx

Back to the top