piyushpatil/androidpushnotification 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

piyushpatil/androidpushnotification

Composer 安装命令:

composer create-project piyushpatil/androidpushnotification

包简介

Laravel package to send push notifications to android mobile devices (gcm)

README 文档

README

Package to enable sending push notifications to android devices.

Installation

Update your composer.json file to include this package as a dependency

"piyushpatil/androidpushnotification": "dev-master"

Register the PushNotification service provider by adding it to the providers array in the config/app.php file.

'providers' => [
     'Piyushpatil\Androidpushnotification\AndroidpushnotificationServiceProvider',
]

Alias the PushNotification facade by adding it to the aliases array in the config/app.php file.

'aliases' => [
    'PushNotification' => 'Piyushpatil\Androidpushnotification\Facades\PushNotification',
]

Configuration

Copy the config file into your project by running

 php artisan vendor:publish --provider="piyushpatil/androidpushnotification" --tag="config"

This will generate a config file like this

    return [
    'Android' => [
        'environment' => 'production',
        'apiKey' => 'yourAPIKey',
        'service' => 'gcm'
    ]
];

Where all first level keys corresponds to an service configuration, each service has its own properties, android for instance have apiKey. You can set as many services configurations as you want, one for each app.

Dont forget to set service key to identify Android 'service'=>'gcm'

Where app argument Android refers to defined service in config file. To multiple devices and optioned message:

In Controller file write this line.

use PushNotification; 


PushNotification::app('Android')
                ->to($deviceToken)
                ->send('Hello World, i`m a push message');


$devices = PushNotification::DeviceCollection(array(
    PushNotification::Device('token', array('badge' => 5)),
    PushNotification::Device('token1', array('badge' => 1)),
    PushNotification::Device('token2')
));

collection = PushNotification::app('Android')
    ->to($devices)
    ->send($message);

// get response for each device push
foreach ($collection->pushManager as $push) {
    $response = $push->getAdapter()->getResponse();
}

[Notification Package]:https://github.com/Ph3nol/NotificationPusher
[Laravel Queues]:http://laravel.com/docs/queues

统计信息

  • 总下载量: 96
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固