PHP script to send Android, iOS and Windwos Phone push notification

Joash Pereira
Joash’s Blog
Published in
2 min readMar 18, 2015
php-script-push-notification-in-android-ios-windows

Simple setup of Push notification php script for android, ios and windows phone 8 devices. Push notifications are great for keeping users informed with timely and relevant content, whether your app is running in the background or inactive. Notifications can display a message, play a distinctive sound, or update a badge on your app icon.

Android devices receive push notifications through the Google Cloud Messaging (GCM) service , whereas iOS devices receive them from the Apple Push Notifications (APN) Service and Windows Phone 8 devices receive them from the Microsoft Push Notification Service (MPNS). Though there are differences in the three services in terms of the size of the payload that can be sent, certificates required etc.

All three act as a store and forward type of service where they receive a message from a 3rd party, identify the recipient and pass it along. Upon receipt, your application that has registered to receive them can examine the returned contents and act accordingly. For more on each of the service, read their respective documentation.

Android Pre-requisites
Google Cloud Messaging Project ID
Google Cloud Messaging API Key for above Project ID (need for server)

iOS Pre-requisites
App ID configured for Push Notifications on Apple Developer Portal
SSL Certificate and private key (need for server)

WP8 Pre-requisites
The name of our push channel

I have worked on cordova / phonegap apps and I’m using push notifications for all the major platforms. So, thought of creating this useful script which is highly configurable and easy to use. The cordova push notification plugin, I have been using. And, I have created a Gist on Github of the php script to send push notifications to various devices.

--

--