2024年4月26日发(作者:电脑怎么卸载360)
基
于
∽
<
l ver l i ght for Wi ndows Phone的图书馆推送通知的设计
Push Notifications Based on Si lverl i9ht for Windows Phone Design
cD
(o
了
o
≤
3
王建荣 0 Q
Wang Jianrong ≤
∞
(青海大学图书馆-。
,
青海西宁810016) o 了
(Qinghai University Library,Qinghai Xining 810016) 3 (D
的
摘要:利用推送技术根据用户需要,有目的、定制以及个性化地为用户提供信息主动服务。第三代、第 书 图
四代移动通信技术的进步,以及智能手机的普及,使得信息的推送通知服务已经成为智能手机的重要功能。 馆
关键词:推送通知;Windows Phone 推
送
中图分类号:TP311 文献标识码:A 文章编号:1671—4792(2012)05.0141—04 通
知
Abstract:Using,push technology based on user needs,to provide information on active service purposely, 的
customized and personally for the user.With the advancement of the third—generation and fourth-generation mobile 设
计
communication technology,as well as the popularity of smart phones,information of the push notiifcation service
has become all important feature of smart phones.
Keywords:Push Notiifcation;Windows Phone
0引言 需要,有目的、定制以及个性化地为用户提供信息主
网络和信息技7R以及移动智能终端技术的飞速 动服务【lJ。第三代、第四代移动通信技术的进步,以
发展,越来越紧密地将信息用户、信息资源、信息服 及智能手机的普及,使得信息的推送通知(PushNo
务系统联系起来。人们对于随时随地获取信息的要tiifcation)服务已经成为智能手机的重要功能。
求变得越来越强烈,对信息的需求在内容和获取方 1主流智能手机的推送通知
式上也出现了变化。不再满足于获得文献线索和索 推送通知技术其实跟移动设备的特点紧密相
取原文,不再满足于使用固定终端连接到互联网络 关。移动设备网络的不稳定性,决定了以Socket为
上,而是希望以一种相对稳定和可靠的形式,利用方 代表的强连接方式并不适用,所以大家更多选择
便、快捷的网络资源获取各种动态性、有针对性的信HTTP协议作为主要的通讯方式。HTTP的特点是:
息,突破地域和时间的限制。 设备找服务器很容易,通过URL就可以了;服务器
网络环境使图书馆的信息服务由原来的以馆藏 找设备就困难了,因为设备会随时切换移动网络,使
为中心的服务模式向以读者用户为中心的服务模式 得II)地址之类的经常性失效。当然设备端轮询的方
转变,改变原来简单、静态、被动服务方式为复杂、动 式可以解决这个问题,但移动设备的电源、网络都是
态、主动服务方式。推送通知服务就是在网络环境下 稀缺资源,所以,OS级别的推送通知技术就成为一
产生的一种新型服务模式。利用推送技术根据用户 种珍贵的战略资源。而且,在封闭式的操作系统中,
1 4It
2.2图书馆推送通知实现httpChannel=HttpNotiifcationChanne1.Find(chan一
通过基于Silverlii曲t for Windows Phone的推送 nelName); 基
通知来实现图书馆的主动信息服务。如:图书催还、
新书通报、预约图书到达通知等。
步骤如下:
if(httpChannel『=nul1)
{httpChanne1.Close();
httpChanne1.Dispose();}
于
∽
c< D
‘ZQ 3"
(1)Windows Phone客户端应用程序请求与微
软推送通知服务(Microsoft Push Notifcation Ser-
httpChannel--new HttpNotiifcationChannel(chan一
nelName,”NotiifcationService”);
o
≤
vices 建立通道连接,微软推送通知服务使用通道
URI响应。
(2)Windows Phone客户端应用程序向监视服
务(Wcb Service或者Cloud Application)发送包含推
送通知服务通道URI以及负载的消息。
(3)当监视服务检测到信息更改时(如图书催
还、预约通知或新书通知),它会向微软推送通知服
务发送消息。
(4)微软推送通知服务将消息中继到Windows
Phone设备,由Windows Phone客户端应用程序处
理收到的消息。
(5)需要时Windows Phone设备往Cloud服务
读取更多的数据。
客户端部分代码:
namespace PushNotiifcations
{
public partial class MainPage:PhoneApplication・-
Page
{
private HttpNotificationChannel httpChannel;
private const string channelName=”Channel1”;
public MainPage0
{InitializeComponemO;}
pfiv ̄e void buttonl
—
Click(object sender,Rout-
edEventArgs e)
{
Q
httpChanne1.ChannelUriUpdated+=new Even— ≤ o
∞
tHandler<NotiifcationChannelUriEventArgs>(h ̄}Cha "了 13
o
nnel
_
ChannelUriUpdated); 3 (D
httpCharmc1.ErrorOccurred+=new EventHandler 的
图
<NotiifcationChannelErrorEventArgs>(httpCharmel_ 书
馆
ErrorOccurred); 推
送
httpChanne1.HttpNotiifcationReceived+=new 通
知
EventHandler<HttpNotiifcationEventArgs>(httpChan一 的
设
nel
_
HttpNotiifcationReceived); 计
httpChanne1.ShellToastNotiifcationReceived+=
new EventHandler<NotificationEventArgs>(httpChan一
nel
_
ShellToastNotiifcationReceived);
httpChanne1.Open();
httpChanne1.BindToShellToast0;
httpChanne1.BindToShellTi1e();
)
void httpChannelShellToastNotiifcationRe--
_
ceived(object sender,NotiifcationEventArgs e)
{
string msg=’’”:
foreach(var key in e.Collection.Keys)
{msg+=key+”:”+e.Collection[key]+Envi-
ronment.NewLine;}
Dispatcher.Beginlnvoke(0=>
{MsgTextBlock.Text=msg;));
)
1 4
—一
void httpChannel
_
HttpNotiifcationReceived(ob—
ject sender,HttpNotiifcationEventArgs e)
{using(var reader=new StreamReader(e.Notiif—
cation.Body))
{stirng msg=reader.ReadToEnd0;
Dispatcher.Beginlnvoke(0=>
{MsgTextBlock.Text=msg;));
)
}
void httpChannel
_
ErrorOccurred(object sender,
NotiifcationChannelErrorEventArgs e)
{
Dispatcher.Beginlnvoke(0=>
{MsgWextBlock.Text=e.Message;));
}
void httpChannel
—
ChannelUriUpdated(object
sender,NotiifcationChannelUriEventArgs e)
{Debug.WriteLine(”ChannelUri:{0 e.Chart—
nelUri);)
}
)
实现效果如图五所示。
4结束语
智能终端的推送通知服务在行业内有着大量的
应用方向,是当今互联网非常火热的一个技术方向。
当然,深层次地定制个性化的推送服务需要用户本
身的行为习惯和私人信息的支持。但是在信息大爆
】44
图五实现效果图
炸的今天,通过智能推送使用户及时掌握有价值的
信息,是有效过滤信息、解决信息超载的重要前提。
参考文献
[1]梁宇红,刘红丽.图书馆信息推送服务的潜
力与开发策略[J].图书馆论坛,2012,(03):144—147.
[2]马宁.Windows Phone 7.1初体验(二)Push
Notifcation[EB/OL].http://www.cnblogs.com/aawolf/
archive/201 1/08/02/2124442.htm1.
[3]GoogleI/O2010:android-push—applications
[EB/OL]。http://wenku.baidu.com/view/9e2225323968
01lca30091 l6.htm1.
【4]Windows Phone开发中心.开发lT具[EB/OL].
hUp://www.microsoft.comJen—us/download/details.as—
px?displaylang--en&i-d:27570.
作者简介
王建荣(1973一),男,汉族,甘肃榆中人,助馆,
硕士,主要研究方向:下一代互联网。
发布者:admin,转转请注明出处:http://www.yc00.com/xitong/1714131375a2387376.html
评论列表(0条)