泛美卫生组织MQTT Android的服务叫醒活动 [英] Paho MQTT Android service wake up activity

查看:136
本文介绍了泛美卫生组织MQTT Android的服务叫醒活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用泛美卫生组织的Andr​​oid MQTT库(从这里下载)。
示例服务应用程序正常工作时,订阅和发布的方法做工精细示例应用程序运行得时。
当我'关​​闭'了,设备没有收到邮件通知了。
有没有人有经验,如何修改/正确执行服务来接收,即使应用程序没有运行的消息?

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 ?

谢谢!

推荐答案

您应该实现一个后台服务看: http://developer.android.com/training/run-background-service /index.html

You should implement a background service see: http://developer.android.com/training/run-background-service/index.html

或者根据不同的使用情况下,可以实现在服务器端的推送通知,并接受他们一旦客户不订阅到MQTT经纪人。

Or depending on the use case you can implement push notifications in the server side and receive them once the client is not subscribed to the MQTT broker.

这篇关于泛美卫生组织MQTT Android的服务叫醒活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆