版本 laravel5.4
1.安装 cmd cd 到项目文件 执行安装
composer require zzl/umeng
2.配置信息 打开配置文件app.php文件,找到providers 和 alias,添加如下代码:
providers
Zzl\Umeng\UmengServiceProvider::class,
alias
'Umeng' => Zzl\Umeng\Facades\Umeng::class,
3.生成配置文件:
php artisan vendor:publish
4.配置参数
在配置文件umeng.php中填入appkey以及master_secret既可完成配置
图片.png
5. 仔细阅读文档
地址:https://developer.umeng.com/docs/66632/detail/68343
6. 配置安卓端推送
7. 配置ios端推送
$device_token = '5184797ce8db81141483d08553b802e3504febc7db1998b69fa1df1a7955794b';
$alias_type = 'alias';
$alias = 'alias1310';
$predefined= ['alert' =>array('title' => 'ios ticker','subtitle' => 'ios subtitle','body' => 'ios body'),"sound"=>"default"];
$extraField = ['description'=>'wefrs'];
// $C =Umeng::ios()->sendBroadcast($predefined, $extraField); //广播
// $C1 =Umeng::android()->sendBroadcast($predefined1, $extraField1); //广播
$a = Umeng::ios()->sendUnicast($device_token,$predefined, $extraField); //单播
$b = Umeng::ios()->sendCustomizedcast($alias = 'alias1310', $alias_type = 'alias',$predefined, $extraField); //自定义播,通过alias
8. 其他推送形式
sendBroadcast(extraField = []); //广播
sendUnicast(predefined= [], $extraField = []); //单播
sendListcast(predefined= [], $extraField = []); //列播
sendFilecast(predefined= [],$extraField = []); //文件播
sendGroupcast(predefined= [], $extraField = []); //组播
sendCustomizedcast(alias_type = '', extraField = []); //自定义播,通过alias
sendCustomizedcastFileId(predefined= [], $extraField = []); //自定义播,通过file_id
网友评论