1 / 65
文档名称:

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

格式:doc   大小:26KB   页数:65页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

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

上传人:平儿 2022/1/26 文件大小:26 KB

下载得到文件列表

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

文档介绍

文档介绍:构建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