网页下的客户端完成后,自然要有对接,下面就要研究手机端了,没有苹果手机,就研究安卓吧,
现在安卓的开发环境是Android Studio,好用,不过网上很多资料还是老的,需要区别对待
安卓系统常用的开发语言是java,所以这次要找的MQTT包也要是Java的,官网
https://github.com/mqtt/mqtt.github.io/wiki/libraries
上的首推Java包为Eclipse Paho Java
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/
不过这个下来并不知道怎么来用
只能四处搜寻资料,找到官方的一篇向导,英文的,努力看吧
http://www.eclipse.org/paho/clients/android/sample/
里边的图片让我眼前一亮
Import the org.eclipse.paho.android.service.sample app project into Eclipse. Copy the org.eclipse.paho.client.mqttv3-{VERSION}.jar and org.eclipse.paho.android.service-{VERSION}.jar library into the libs folder in the Android project. Make sure no compilation errors and then run as Android application. Or install and start the MQTT client sample Java app on an Android device. See the developer.android.com Running your app page.
跟着步骤去做
那么问题来了org.eclipse.paho.client.mqttv3-{VERSION}.jar and org.eclipse.paho.android.service-{VERSION}.jar在哪里,没有搜索到,想到了java打包,也尝试了用eclipse,似乎总是少点什么,突然看到上边忽略的
Clone the source code of org.eclipse.paho.mqtt.java via git. Run maven build: mvn clean install to build org.eclipse.paho.client.mqttv3-{VERSION}.jar and org.eclipse.paho.android.service-{VERSION}.jar
好像需要一个称为maven的东西,通过查询eclipse集成了,但是还是不会用
对于新的环境
Copy the org.eclipse.paho.client.mqttv3-{VERSION}.jar and org.eclipse.paho.android.service-{VERSION}.jar library into the libs folder in the Android project.
又不知道怎么做了,这时才发现百度经验是个好东西
http://jingyan.baidu.com/article/e6c8503c7190b7e54f1a1893.html
需要新建一个libs文件夹,然后拷进去,再Add As Library
打赏帖 | |
---|---|
汽车+汽车地线之间连接处理被打赏20分 | |
【Zephyr】使用Zephyr外设初始化过程解析被打赏30分 | |
【S32K146】S32DS watchdog 配置使用被打赏20分 | |
【Zephyr】使用 IAR 调试 Zephyr 镜像被打赏20分 | |
赚取电动螺丝刀+电源电路理论知识分享1被打赏5分 | |
我想要一部加热台+分享常见运算放大器电路的应用被打赏5分 | |
【Zephyr】MCXN947 Zephyr 开发入门适配shell被打赏20分 | |
我想要一部加热台+常见的MOS管驱动电路被打赏5分 | |
【我要开发板】6.联合MATLAB记录数据被打赏50分 | |
【换取手持数字示波器】MicrochipMPLABHarmony框架下串口调试printf输出记录被打赏29分 |