Paho MQTT Android service wake up activity

wyzard picture wyzard · Jan 25, 2015 · Viewed 8.7k times · Source

I am trying to use Paho Android MQTT library (downloaded from here). The sample service application works fine, the subscribe and the publish methods work fine too when the sample application is running. When I close it, the device doesn't receive message notifications anymore.

Does anyone has an experience how to modify/implement the service correctly to receive message even if the application isn't running?

Answer

kdoteu picture kdoteu · Jul 8, 2015

As far as I understand the topic Paho brings all you need. In my application the paho mqtt-service never stops until I want it. I registered the Paho-service in the manifest to Android with the following snippet.

‹!-- Mqtt Service --›
‹service android:name="com.ibm.android.service.MqttService" /›

This should do the trick.

More information in the description of http://www.eclipse.org/paho/files/android-javadoc/index.html