Skip to main content

IOS Push Notification PHP class using Apple Push Notification Service (APNs)

Apple Push Notification Service (APNs) is the center peace of the remote notification features. It is quick and highly efficient service for receiving notification throw-out the IOS devices. Apple Push Notification service sends and routes remote notifications for your apps from your provider to each user’s device. You can send notifications through APNs to many devices on which the client apps are installed. You can find more about APNs on official Apple developer site at https://developer.apple.com/. This tutorial is dedicated to Ankit Kansara who submitted a request throw our Request a Tutorial page for Ios PUSH NOTIFICATION PHP Class

Android Push Notification PHP class using Google Cloud Messaging (GCM)

Google cloud Messaging (GCM) is a service that helps developer to send push notification data to any Android devices. With help of this feature developer can send push message to Android device whenever new data or promotion offers arrives in Android application.

Today lots of Android applications using Google cloud Messaging service to send multiple push messages to multiple Android devices. You can find more at it’s official document at https://developers.google.com/cloud-messaging/

Push Notification flow with PHP Web Server APP and GCM

android_push

  1. Android device send Sender Id and application Id to GCM server.
  2. GCM server generates unique registration Id and sends them back to Android device.
  3. Android device sends registration Id to PHP web server application.
  4. PHP web server stores registration Id to Database for later use.
  1. When server needs to send Push Message, It fetch previously stored registration Id from Database
  2. And send them to the GCM server along with the push message data.
  3. GCM server will send that message to particular Android device using device registration Id

Push Notification to the browser with Javascript

Push notification to the browser is a way to send an information message to the browser same like you experiencing in mobile Apps like Facebook or Whatsapp.

You can do so using a simple jQuery and Javascript code, Today we will only cover the Javscript part in this tutorial.

Try Demo

Ask User for notification permission

First of all we need to request for the permission to user to allow browser notification.

notification-permission

 

Initialize the notification object

If user have granted for notification, we need to initialize the notification object where we need to pass few parameters