- 浏览: 269908 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
成大大的:
Android自动化测试从入门到精通网盘地址:https:// ...
Android自动化测试手段之Monkey -
opadnjmdl:
Android自动化测试从入门到精通链接:http://pan ...
Android自动化测试手段之Monkey -
yezhiyouling:
为什么转换的视频不完整呢??一个3分钟的视频只能转换1分钟都不 ...
java调用视频转换工具ffmpeg -
fanfq:
Jocson 写道http://javapapers.com/ ...
Android Server Push - GCM -
fanfq:
zzudhj 写道是啊 !这里得到的b1是null.不知道为何 ...
android屏幕截图
最近花了较长的时间重点研究有关服务器推送的技术,在下面的几篇文章中分别总结下Android C2DM,MQTT,Androidpn推送的通知。
敬请期待...
2012.2.14
哈哈,没想到有朋友也用到这个玩意,最近一段时间比较忙一直没有跟新。现在先简单的介绍下怎么配置。
MQTT的环境配置很简单,
Server
1.首先你需要安装apache php运行环境,网上有现成的集成的安装环境。
apache php环境安装好后将tokudu-PhpMQTTClient-ba4e494.zip解压至webroot目录下,然后启动apache服务
2.如果你是windows 环境在服务器端再启动 rsmb_1.2.0.zip\windows\borker.exe (我一开始客户端始终连接不上服务器就是因为这个服务没有开)
3.Client
tokudu-AndroidPushNotificationsDemo-ea18b09.zip\tokudu-AndroidPushNotificationsDemo-ea18b09\src\com\tokudu\demo\PushService.java
line 38
private static final String MQTT_HOST = "209.124.50.174"; (修改成你的服务器端ip)
好了就这三步,MQTT的环境就配置好了,然后重新编译客户端的程序并且安装手机或者模拟器中。再在服务器端查看,你会看见server status 变成online了,那就表明客户端连接成功。然后就可以向客户端发送消息了。
由于时间关系就先写这么多了,如有疑问我再跟新的。
2012.3.20
我想应该是因为这个:
// Set quality of services to 0 (at most once delivery), since we don't want push notifications
// arrive more than once. However, this means that some messages might get lost (delivery is not guaranteed)
private static int[] MQTT_QUALITIES_OF_SERVICE = { 0 } ;
private static int MQTT_QUALITY_OF_SERVICE = 0;
这段代码在PushService.java中
再在服务器端查看,你会看见server status 变成online了
是在哪里看用户列表呢,php页面吗,还是那边啊,php页面推送目标(push target)填写什么啊
虽说单位时间内处于长连接状态,但其实是短连接,每过一个周期会发一个心跳包已确保连接可用。后台会起一个线程池管理这些套接字的,至于资源会耗谁叫他是服务器呢。
没有在2003上试过,我的测试环境是win7.
亲,我和你遇到一样的问题。求楼主解决。
先启服务器,再启客户端。
本来就是所有的设备都可以收到push的信息的。你多用几个设备试下不就知道了。
之前的socket error的问题解决了没?
I can't recreate the problem,So I can't give you an accurate answer.
You'd better try it on windows OS.
Thanks,
敬请期待...
2012.2.14
哈哈,没想到有朋友也用到这个玩意,最近一段时间比较忙一直没有跟新。现在先简单的介绍下怎么配置。
MQTT的环境配置很简单,
Server
1.首先你需要安装apache php运行环境,网上有现成的集成的安装环境。
apache php环境安装好后将tokudu-PhpMQTTClient-ba4e494.zip解压至webroot目录下,然后启动apache服务
2.如果你是windows 环境在服务器端再启动 rsmb_1.2.0.zip\windows\borker.exe (我一开始客户端始终连接不上服务器就是因为这个服务没有开)
3.Client
tokudu-AndroidPushNotificationsDemo-ea18b09.zip\tokudu-AndroidPushNotificationsDemo-ea18b09\src\com\tokudu\demo\PushService.java
line 38
private static final String MQTT_HOST = "209.124.50.174"; (修改成你的服务器端ip)
好了就这三步,MQTT的环境就配置好了,然后重新编译客户端的程序并且安装手机或者模拟器中。再在服务器端查看,你会看见server status 变成online了,那就表明客户端连接成功。然后就可以向客户端发送消息了。
由于时间关系就先写这么多了,如有疑问我再跟新的。
2012.3.20
- rsmb_1.2.0.zip (1 MB)
- 下载次数: 521
- tokudu-AndroidPushNotificationsDemo-ea18b09.zip (66.6 KB)
- 下载次数: 392
- tokudu-PhpMQTTClient-ba4e494.zip (54 KB)
- 下载次数: 388
评论
27 楼
xlian
2013-10-23
pdztop 写道
我第一次推送成功了 然后我继续推就收不到了 这是为什么呢
我想应该是因为这个:
// Set quality of services to 0 (at most once delivery), since we don't want push notifications
// arrive more than once. However, this means that some messages might get lost (delivery is not guaranteed)
private static int[] MQTT_QUALITIES_OF_SERVICE = { 0 } ;
private static int MQTT_QUALITY_OF_SERVICE = 0;
这段代码在PushService.java中
26 楼
pdztop
2013-10-22
我第一次推送成功了 然后我继续推就收不到了 这是为什么呢
25 楼
happytianqiu
2013-10-15
你好,我用的也是tokudu的mqtt android,但这个我测试后发现不稳定,推送一天下来就收不到信息了,这个是什么原因呢?要怎么解决
24 楼
cvb21354
2013-04-25
djy252 写道
还有个问题,php service如何获取 连接的用户列表呢?没有这个列表,操作很困难的
再在服务器端查看,你会看见server status 变成online了
是在哪里看用户列表呢,php页面吗,还是那边啊,php页面推送目标(push target)填写什么啊
23 楼
djy252
2012-12-03
还有个问题,php service如何获取 连接的用户列表呢?没有这个列表,操作很困难的
22 楼
djy252
2012-12-03
php的难搞定啊。
楼主能把php的改成 ASP。net的吗?
楼主能把php的改成 ASP。net的吗?
21 楼
fanfq
2012-09-27
xiaoyu6135013 写道
请教下,你php服务端是如何接收信息?(因为接收信息为一个堵塞的方法,会把服务器资源耗尽)
虽说单位时间内处于长连接状态,但其实是短连接,每过一个周期会发一个心跳包已确保连接可用。后台会起一个线程池管理这些套接字的,至于资源会耗谁叫他是服务器呢。
20 楼
xiaoyu6135013
2012-09-27
请教下,你php服务端是如何接收信息?(因为接收信息为一个堵塞的方法,会把服务器资源耗尽)
19 楼
fanfq
2012-08-30
Jason_Bourne 写道
楼主你好,我把mqtt服务端部署到win2003下,运行broker程序报应用程序错误,请问这是怎么回事呢?
没有在2003上试过,我的测试环境是win7.
18 楼
Jason_Bourne
2012-08-30
楼主你好,我把mqtt服务端部署到win2003下,运行broker程序报应用程序错误,请问这是怎么回事呢?
17 楼
kongnanlive
2012-08-26
s2q1984 写道
2.33下正常使用,但是到4.0以上系统就接不到消息了
亲,我和你遇到一样的问题。求楼主解决。
16 楼
s2q1984
2012-08-15
2.33下正常使用,但是到4.0以上系统就接不到消息了
15 楼
fanfq
2012-08-03
hanheihanhei 写道
android 客户端安装在模拟机上面,点击启动服务,总是异常退出。查看logcat,有一下输出:
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
W/dalvikvm( 1033): VFY: unable to find class referenced in signature (Lcom/ibm/m
qtt/MqttPersistence;)
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
E/dalvikvm( 1033): Could not find class 'com.tokudu.demo.PushService$MQTTConnect
ion', referenced from method com.tokudu.demo.PushService.connect
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
W/dalvikvm( 1033): VFY: unable to find class referenced in signature (Lcom/ibm/m
qtt/MqttPersistence;)
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
E/dalvikvm( 1033): Could not find class 'com.tokudu.demo.PushService$MQTTConnect
ion', referenced from method com.tokudu.demo.PushService.connect
先启服务器,再启客户端。
14 楼
fanfq
2012-08-03
wangxinasy 写道
请问如何想所有设备发送消息啊?他的demo中只有像单个设备发送消息
本来就是所有的设备都可以收到push的信息的。你多用几个设备试下不就知道了。
13 楼
wangxinasy
2012-08-01
请问如何想所有设备发送消息啊?他的demo中只有像单个设备发送消息
12 楼
hanheihanhei
2012-06-20
android 客户端安装在模拟机上面,点击启动服务,总是异常退出。查看logcat,有一下输出:
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
W/dalvikvm( 1033): VFY: unable to find class referenced in signature (Lcom/ibm/m
qtt/MqttPersistence;)
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
E/dalvikvm( 1033): Could not find class 'com.tokudu.demo.PushService$MQTTConnect
ion', referenced from method com.tokudu.demo.PushService.connect
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
W/dalvikvm( 1033): VFY: unable to find class referenced in signature (Lcom/ibm/m
qtt/MqttPersistence;)
I/dalvikvm( 1033): Failed resolving Lcom/tokudu/demo/PushService$MQTTConnection;
interface 35 'Lcom/ibm/mqtt/MqttSimpleCallback;'
W/dalvikvm( 1033): Link of class 'Lcom/tokudu/demo/PushService$MQTTConnection;'
failed
E/dalvikvm( 1033): Could not find class 'com.tokudu.demo.PushService$MQTTConnect
ion', referenced from method com.tokudu.demo.PushService.connect
11 楼
n.adepu
2012-05-07
Hello Tree Juan,
Thanks for you reply. I have installed php and apache servers in my linux server. Please see the below result. And could you please tell me what php&httpd dependencies are required to run MQTT successfully
[root@user ~]# php -v
PHP 5.3.3 (cli) (built: Feb 2 2012 23:24:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@user ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Feb 13 2012 22:25:23
Thanks
Thanks for you reply. I have installed php and apache servers in my linux server. Please see the below result. And could you please tell me what php&httpd dependencies are required to run MQTT successfully
[root@user ~]# php -v
PHP 5.3.3 (cli) (built: Feb 2 2012 23:24:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@user ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Feb 13 2012 22:25:23
Thanks
10 楼
fanfq
2012-05-04
树娟king 写道
没有遇到过,貌似端口号的问题。你有该端口号么?
没有修改啊 端口号是1883没坐修改,我在想是不是PHP服务端的问题啊!
没有修改啊 端口号是1883没坐修改,我在想是不是PHP服务端的问题啊!
之前的socket error的问题解决了没?
9 楼
fanfq
2012-05-04
n.adepu 写道
Hello,
I'm also facing the sam problem in linux centos 6.2
20120502 170654.690 CWNAN0020W Socket error on socket 4, peer address 127.0.0.1:32993; ending connection
Please someone help me. I would appreciate your help.
Thanks
I'm also facing the sam problem in linux centos 6.2
20120502 170654.690 CWNAN0020W Socket error on socket 4, peer address 127.0.0.1:32993; ending connection
Please someone help me. I would appreciate your help.
Thanks
I can't recreate the problem,So I can't give you an accurate answer.
You'd better try it on windows OS.
Thanks,
8 楼
n.adepu
2012-05-02
Hello,
I'm also facing the sam problem in linux centos 6.2
20120502 170654.690 CWNAN0020W Socket error on socket 4, peer address 127.0.0.1:32993; ending connection
Please someone help me. I would appreciate your help.
Thanks
I'm also facing the sam problem in linux centos 6.2
20120502 170654.690 CWNAN0020W Socket error on socket 4, peer address 127.0.0.1:32993; ending connection
Please someone help me. I would appreciate your help.
Thanks
发表评论
-
获取手机短信
2016-12-15 14:22 739import android.content.pm.P ... -
使用aapt工具获取android package信息
2016-11-02 15:30 824aapt 位于 android sdk下的build-tool ... -
编译shadowsocks-android工程
2016-10-31 13:51 3960之前是买的ss的账号,每年的费用差不多300块RMB,服务也比 ... -
ubuntu sbt 安装
2016-10-31 13:41 891真的还是第一次听说过sbt,没想到如此之牛逼。不是编译程序用到 ... -
git ss代理配置
2016-10-31 12:57 2043#http、https代理的配置与取消 git config ... -
Android - Device Administration
2014-07-09 14:08 1268课程内容 定义和声明您的策略 创建 Dev ... -
android屏幕解锁
2012-09-24 16:23 1520KeyguardManager km = (KeyguardM ... -
Android Server Push - Urban Airship
2012-09-08 01:25 3663Android Server Push Solutions A ... -
Android Server Push - GCM
2012-08-14 22:11 2309http://developer.android.com/gu ... -
偷数据
2012-08-13 22:20 4一个朋友最近谈了女朋友,他告诉我他想开发一款公交车查询的app ... -
小米手机离一坨屎的距离
2012-04-25 10:56 2151前言 媳妇想换部手机, ... -
Funambol 编译
2012-03-08 23:18 3108前面介绍过有关服务器推送,最终选择Androidpn应用于我们 ... -
Android Server Push - C2DM
2012-02-14 11:38 1548C2DM 敬请期待 -
Android Server Push - Androidpn
2012-02-14 11:36 3902Server androidpn-server-0.5.0-b ... -
Failure [INSTALL_FAILED_OLDER_SDK]
2011-07-26 13:41 2077/build/core/version_defaults.mk ... -
android模块编译,mm,mmm 模块编译 .
2011-07-26 11:00 3685from http://jinguo.javaeye.co ... -
通过wifi连接设备
2011-05-17 11:35 2123set ADB_HOST=192.168.1.1 ... -
Android核心分析
2011-02-25 16:08 1507文章皆来自CSDN网友maxleng的专栏,maxleng ... -
Android 内核编绎错误解决方案
2011-01-18 18:53 2641错误1: ... -
ubuntu 下ADB驱动安装
2011-01-17 13:54 3199http://blog.csdn.net/zhenwen ...
相关推荐
adoption of MQTT protocol enables real-time communication between Android client and App Server, solving the difficulty of Android push notification. 在 Android 消息推送通知中,C2DM 是一个重要的角色...
Open the connection to the MQTT server mqtt connect ; }">测试通过 mosquitto代理 protected void connect String host String client { Default host is test mosquitto org you should change this ...
Android推送原理,也被称为Android Push Notification,是一种在应用程序不运行时向用户传递信息的技术。它允许服务器端将数据推送到Android设备,即使应用在后台或完全关闭也能接收到通知。这种技术对于保持用户与...
首先,Android平台的消息推送机制通常有三种方式:轮询(Pull)、SMS(Push)以及持久连接(Push)方式。轮询方式由客户端定期向服务器询问新消息,但频繁查询会消耗电量和流量,而低频率则可能导致信息延迟。SMS...
在iOS平台上,这个功能可以通过苹果的Push Notification Service(APNS)轻松实现,但在Android系统中,情况较为复杂。Google为此提供了Cloud to Device Messaging(C2DM)服务,允许服务器向Android应用程序发送...
对于Android和iOS的推送,可能涉及到各自的操作系统提供的推送通知服务,如Google的Firebase Cloud Messaging(FCM)和Apple的Push Notification Service(APNs)。源码可能会包含与这些服务接口的实现,以确保即使...
- **C/S架构**:客户端(Client)与服务器(Server)模式,客户端发送请求,服务器响应。 2. **协议标准**: - **XMPP(Extensible Messaging and Presence Protocol)**:开放标准,用于实时通讯和消息传递。 -...
1. **即时通讯协议**:即时通讯软件一般基于XMPP(Extensible Messaging and Presence Protocol)协议、MQTT(Message Queuing Telemetry Transport)协议或自定义协议。这些协议确保数据在客户端和服务器间安全、...
配合长轮询或HTTP/2 Server Push技术,可以实现低延迟的实时通信。 7. **聊天记录存储**:历史消息通常需要持久化存储,可以使用关系型数据库(如MySQL)、NoSQL数据库(如MongoDB)或者云存储服务。 8. **多媒体...
根据文件名“IMCS”,可能是“Instant Messaging Client/Server”的缩写,暗示可能使用的是C++或Java,因为这些语言在构建客户端-服务器架构时较为常见。 2. **客户端**:聊天软件的客户端负责用户界面、输入输出、...