下载此文档

构建Android Push Notification Service服务端及客户端[含代码] - 48 views.doc


文档分类:IT计算机 | 页数:约65页 举报非法文档有奖
1/65
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/65 下载此文档
文档列表 文档介绍
构建Android Push Notification Service服务端及客户端[含代码] - 48 views
终于又开始上班了,只有在值班的时候,才是我比较清闲的时候,可以静下来做自己喜欢的事情,看自己喜欢的文章,写自 + Php环境
tokudu兄的Android源代码
tukudu兄的php代码
mosquitto的可执行程序。
步骤1:
下载mosquitto的可执行程序,我选择的是cygwin版本的,安装后,。
步骤2:下载tokudu兄的php代码,官方地址为:
我这里也提供下载:androidpushservice
主要代码为如下:<?php

require('SAM/');

//create a new connection object
$conn = new SAMConnection();

//start initialise the connection
$conn->connect(SAM_MQTT, array(SAM_HOST => '',
SAM_PORT => 1883));
//create a new MQTT message with the output of the shell command as the body
$msgCpu = new SAMMessage($_REQUEST['message']);

//send the message on the topic cpu
$conn->send('topic://'.$_REQUEST['target'], $msgCpu);

$conn->disconnect();

echo 'MQTT Message to ' . $_REQUEST['target'] . ' sent: ' . $_REQUEST['message'];

?>
将代码部署到php环境目录里面。输入地址:http://localhost/androidpushservice/
步骤三:下载tokudu兄的android代码:
地址:
本文提供下载:
tokudu-AndroidPushNotificationsDemo-ea18b09
导入项目,编译,在真机上面使用打开即可。这里有一个Device Target号码需要在php的界面里面输入。才可以发送成功。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80/*
* $Id$
*/package ;import ;
import ;
import ;
import ;
import ;
import ;
import ;import ;public class ConnectionLog
{
private String mPath;
private Writer mWriter;private static final SimpleDateFormat TIMESTAMP_FMT =
new SimpleDateFor

构建Android Push Notification Service服务端及客户端[含代码] - 48 views 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数65
  • 收藏数0 收藏
  • 顶次数0
  • 上传人学习的一点
  • 文件大小26 KB
  • 时间2022-02-08