基本步骤为Android的使用MQTT步骤、基本、MQTT、Android

2023-09-12 10:45:27 作者:人称小可爱

我是新来的Andr​​oid,想使用 MQTT 作为推通知为Android从服务器。 我看了一下 MQTT ,但并不十分了解。如果任何一个使用了这个库,所以PLZ告诉我,我必须做的,开始使用它。

I am new to Android and want to use MQTT as push notifier for Android from Server. i have read about MQTT but does not understand well. if any one has used this library so plz tell me what i have to do to start using it..

我有一个 Java服务器(运行在Windows上)(上我的应用程序将安装Android手机)和大量的客户端。我的服务器将随时发送消息给全部或部分特定的客户端。

i have a Java Server (Running on Windows) and lots of Client(android phones on which my app will be installed). My server will send message to all or some specific clients at any time.

我有哪些基本要求?我的意思是有

what are my basic requirement ? i mean is there

在服务器的要求? 在某种注册? 图书馆在android的内容? 标识Android设备? (如C2DM要求谷歌帐户为每个设备)

plz帮助我在这方面

plz help me in this regard

推荐答案

您需要:

在它运行在服务器端的MQTT经纪人。这可能是有点像mosquitto经纪人这是开源的。 在一个MQTT客户机库,在你的Andr​​oid应用包含,使您的应用程序连接,订阅和发布消息。有一些列在 http://mqtt.org/software Java选项 要拿出唯一标识用户或设备的方式,然后使用它作为一个议题,使您可以单独发布一个消息到一个设备。 an MQTT broker which runs on the server side. This could be something like the mosquitto broker which is Open Source. an MQTT client library which you include in your Android app, enabling your app to connect, subscribe, and publish messages. There are a number of Java options listed at http://mqtt.org/software to come up with a way of uniquely identifying users or devices, and then use that as a topic so that you can individually publish a message to one device.

戴尔里写了这样一个很好的指南( http://www.dalelane.co.uk/博客/ P = 1599 ),而且也是一个很好的资源集约MQTT(https://github.com/mqtt/mqtt.github.io/wiki)

Dale Lane has written a nice guide on this (http://www.dalelane.co.uk/blog/?p=1599) and there is also a good set of resources about MQTT (https://github.com/mqtt/mqtt.github.io/wiki)