2017 © Pedro Peláez
 

project androidpushnotification

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

image

piyushpatil/androidpushnotification

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

  • Monday, April 13, 2015
  • by piyushpatil027
  • Repository
  • 1 Watchers
  • 2 Stars
  • 76 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Laravel 5 AndroidPushNotification

Package to enable sending push notifications to android devices., (*1)

Installation

Update your composer.json file to include this package as a dependency, (*2)

"piyushpatil/androidpushnotification": "dev-master"

Register the PushNotification service provider by adding it to the providers array in the config/app.php file., (*3)

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

Alias the PushNotification facade by adding it to the aliases array in the config/app.php file., (*4)

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

Configuration

Copy the config file into your project by running, (*5)

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

This will generate a config file like this, (*6)


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., (*7)

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: ```php, (*8)

In Controller file write this line., (*9)

use PushNotification;, (*10)

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

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

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

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

The Versions

13/04 2015

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

laravel notification push gcm