Android Server Push - Urban Airship

[b]Android Server Push Solutions[/b]
[url="http://fanfq.iteye.com/blog/1673878"]Android Server Push - Urban Airship[/url]
[url="http://fanfq.iteye.com/blog/1632081"]Android Server Push - GCM[/url]
[url="http://fanfq.iteye.com/blog/1405393"]Android Server Push - C2DM[/url]
[url="http://fanfq.iteye.com/blog/1405392"]Android Server Push - Androidpn[/url]
[url="http://fanfq.iteye.com/blog/1405385"]Android Server Push - MQTT[/url]

最近在玩salesforce(SFDC),公司购买的SFDC的企业级服务,在各种安全性的机制下我们研发工作不会像传统项目开发那么灵活,如果SFDC官方不提供某种需求解决方案的话我们基本上束手无策,当然SFDC还是很健全的,但就mobile这快说实话目前为止还不是特别完善。

刚好项目中有push需求,其官方尚未提供push的解决方案,但是推荐了其投资的另一家公司Urban Airship方案。所以不得不去研究了下Airship,相对SFDC而言Airship的文档还是蛮健全的没花多少时间Demo就配置出来了。下面重点讲诉一下Airship的demo环境的配置。

[b]1[/b].首先至Urban Airship 网站注册账号 http://urbanairship.com/

[b]2[/b].创建server application,这里需要注意一下 android package 填写你的android项目的目录,其它选项如下图所示。
[img]http://dl.iteye.com/upload/attachment/0073/5179/ed9e86c9-4f3e-3409-96ea-180d64846afe.png[/img]

[b]3[/b].创建android app,附件中我已给出完整的项目。需要注意一下的是需要修改/assets/airshipconfig.properites文件参数,由于是开发模式如上图所示将参数填上去就可以了。没错在这里你看到了c2dm,不过没关系我的这个demo使用的helium模式,你可以完全忽略c2dm的存在。(c2dm有点坑爹,景德镇人都知道!如过有朋友对c2dm有经验的话可以在
[url="http://fanfq.iteye.com/blog/1632081"]Android Server Push - GCM[/url]
留言讨论)

developmentAppKey = MgXTazIWQ4msz86tQRmuKw
developmentAppSecret = *****************
productionAppKey = Your Production App Key
productionAppSecret = Your Production Secret

#transport is "c2dm", "helium" or "hybrid".
#note: the helium and hybrid transports are premium features.
#for complete pricing information, see http://urbanairship.com/pricing/

transport = helium

c2dmSender = Your C2DM sender address (required for C2DM: must be an e-mail address)
inProduction = false

iapEnabled = false

# 2 = Log.VERBOSE; 3 = Log.DEBUG; 4 = Log.INFO;
# 5 = Log.WARN; 6 = Log.ERROR; 7 = Log.ASSERT;
developmentLogLevel = 3
productionLogLevel = 6


[b]4[/b].运行android app,如下图所示
[img]http://dl.iteye.com/upload/attachment/0073/5181/8c160b41-250a-35d2-aba6-0acaa3f03be2.png[/img]
在这里需要配置一下,如下图所示
[img]http://dl.iteye.com/upload/attachment/0073/5183/5db9715a-824e-31e6-835c-3b8daf495e1b.png[/img]

[b]5[/b].最后一步,你可以测试一下时候能够可以从服务器端push信息了,如下图所示。

[img]http://dl.iteye.com/upload/attachment/0073/5185/74295a00-6f09-35e4-adac-5b1157207834.png[/img]

好了,大功告成,客户端收到信息了!

[img]http://dl.iteye.com/upload/attachment/0073/5187/c37d4091-3655-3b33-8a78-d8a218943da9.png[/img]


good lucky!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值