PHP头条
热点:

改写百度云推送SDK,PHP PEAR 包:Services_Baidu_Push


iPhone使用apple push很方便,而Android很多厂商删除了google push,而且google在大陆连不上,所以要用别的办法。

Android常见的推送服务商有:极光推送(https://www.jpush.cn/)、百度云推送。

app加入推送的lib,会有一个常驻后台进程,通过推送服务商推送消息,无需启动app。

 

百度云推送官方文档:http://developer.baidu.com/cloud/push

标准URI

PEAR的优势:一键安装到php/lib/php目录,require即可使用,很方便。

百度推送的官方sdk不符合PEAR标准,使用不便,不想为百度重写,所以我改写了一下(sdk中带的很多垃圾没去改写),安装步骤如下:

pear channel-discover sinkcup.github.io/ sinkcup/Services_Baidu_Push

使用步骤:

1、注册登录百度开发者后台,获得api key和secret key,在app里添加lib。

2、demo(参考https://github.com/sinkcup/Services_Baidu_Push/blob/master/tests/Services/Baidu/PushTest.php)

<? 'Services/Baidu/Push.php' = 'asdf' = 'qwer' =  Services_Baidu_Push(,  = "description"=> "testSimplePushToAndroid群发",
    "notification_basic_style"=>7, = ->simplePushToAndroid((?>

()

我的PEAR 频道:http://sinkcup.github.io/pear/

项目源代码:https://github.com/sinkcup/Services_Baidu_Push

www.phpzy.comtrue/php/26.htmlTechArticle改写百度云推送SDK,PHP PEAR 包:Services_Baidu_Push iPhone使用apple push很方便,而Android很多厂商删除了google push,而且google在大陆连不上,所以要用别的办法。 Android常见的推送服务商有:极...

相关文章

相关频道:

PHP之友评论

今天推荐