Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Send Push Notifications with Laravel & Arrow

Send Push Notifications with Laravel & Arrow

Ti Meetup Talk 20015-10-07 (http://www.meetup.com/TitaniumNL/events/224900273/)

Schedule and send APNs + GCM Push Notfications with a custom payload to your Titanium apps using a custom Laravel backend via Appcelerator Arrow Cloud (ACS).


Frank Eijking

October 07, 2015


  1. Send Push Notifications
 with Laravel & Arrow

  2. working @medianique RT’ @karaoak /frankeijking About Me /karaoak

  3. @karaoak Objectives • Fast implementation. • Low costs, with possibly

    a high volume of registered users and/or devices. • Possibility to send and schedule PNs to individual users/devices with a custom payload. • Cross platform!
  4. @karaoak How do Push Notifications actually work? iOS / Mac

    OS X Your backend Ti app developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html Apple Simplistically… token + payload
  5. @karaoak Device Registration developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html

  6. @karaoak Available Options • (M)BaaS • Parse • Kinvey •

    PushWoosh • ACS • Notificare • Self hosted backend
  7. @karaoak Available Options Ti Android support not optimal Capped, expensive

    No *free* remote API access You need an ACS account Expensive Time consuming, certificates, SLA • (M)BaaS • Parse • Kinvey • PushWoosh • ACS • Notificare • Self hosted backend
  8. @karaoak Solution • Fast implementation • Unified Ti app client

    module is already available: ricardoalcocer/acspushmod • No server side GCM and APNs certificate setup. • Unified platform agnostic ACS API, not likely to change, even when Google or Apple change API signature. • Custom backend • Full control with regard to scheduling, ACS has a limit of 100. • Custom client web interface with restricted options and more ease of use than AppC Platform. ACS with a custom Laravel backend, because …
  9. @karaoak Device Registration developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html Laravel

  10. @karaoak Device Registration ricardoalcocer/ acspushmod AppC Platform web admin ACS

    developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html optional Laravel
  11. @karaoak How it works / Setup cURL GCM APNs Ti

    Alloy App AcsPushMod JSON REST API ADMIN WEB INTERFACE RESTe Laravel App Arrow Cloud Push Notifications JSON REST API device registration > < notification Android iOS device token + payload device token + optionally channel token + payload custom api APPC ADMIN WEB INTERFACE
  12. @karaoak Ideally … github.com/HazemKhaled/TiPushNotification GCM + APNs setup including server

    certificates + f.i. GCM APNs Ti Alloy App TiPushNotification JSON REST API ADMIN WEB INTERFACE RESTe Laravel App device registration > < notification Android iOS device token + payload custom api device token TLS socket stream (iOS)
  13. @karaoak Developing the Laravel App • As a backend to

    multiple apps, thus ACS keys. • Via the backend API the Ti app should be able to schedule a push notification. • Commands, Jobs and Queue services. • Custom Admin Web Interface to monitor and send promotional push notifications. • Developer Resources …
  14. @karaoak Build APIs You Won't Hate • by Phil Sturgeon

    • Everybody and their brother’s dog wants an API, so you should probably learn how to build them. • apisyouwonthate.com
  15. @karaoak Laracasts • by Jeffrey Way • It's Like Netflix

    for Developers • laracasts.com
  16. @karaoak • laravel.com - The documentation is very good! •

    Aglio Markdown 2 API documentation
 npmjs.com/package/aglio / apiblueprint.org • forge.laravel.com - Painless PHP Servers • kr.github.io/beanstalkd/ Other Resources DEMO DEMO
  17. @karaoak • github.com/ricardoalcocer/acspushmod • docs.appcelerator.com/platform/latest/#!/guide/ Push_Notifications • http://docs.appcelerator.com/arrowdb/latest/#!/api/ PushNotifications-method-notify_tokens •

    github.com/HazemKhaled/TiPushNotification Titanium Resources
  18. @karaoak Demo !

  19. @karaoak class Acs {
 protected $apiUrl;
 protected $apiKey;

 protected $password;
 protected $cookiePath;
 protected $_errors;
 public function __construct(App $app, Enviro {
 $this->app = $app;
 $this->environment = $environment;
 $this->apiUrl = config('acs.api_url');
 $this->apiKey = $this->getApiKey();
 $this->username = $this->getUsername();
 $this->password = $this->getPassword();
 $this->cookiePath = storage_path('acs/') 
  20. @karaoak

  21. @karaoak

  22. @karaoak Questions?