Building Your Own Push Notifications Server

In my next series of videos I am going to share with you how to build your own push notifications server with PHP & MySQL. And since this blog is about iOS Apps development with Swift programming language, I will also share with you how to send and receive a new push message in your mobile application built in Swift.

Next videos will cover:

  1. How to build your own push notifications server with PHP & MySQL
  2. How to create and send push message with PHP
  3. How to send push message to a specific iOS device
  4. How to send push message to multiple devices or all devices registered with our Swift app
  5. How to send push message and pass along with it additional information to our app
  6. How to specify a push message badge number
  7. How to send a push message and specify which sound to play on device when push message arrives
  8. How to receive push message on iOS device with Swift
  9. How to read and display push message on iOS device
  10. How to perform a specific action in Swift mobile app based on the content of push message.
  11. I will also record a video on how to create and lunch your very own linux web server on Amazon Web Services EC2 and will show you how to install on it PHP, MySQL and Apache2 web server, so that you you indeed can have your very own push notifications server for your Swift app.

If you have a request for a specific functionality I did not list above, please comment below and I will see if I can do it for you :).

I will be publishing videos in this blog post and I hope these videos will bring you some value.

And if you would like to receive more free video tutorials from me, please subscribe to my blog.

Enjoy!

Introduction

 

Introduction to PHP Scripts


Import Database Tables


Copy PHP Scripts Into Local Project


Generating Apple Push Notification Service Certificates


Generating iOS App Production & Development Certificates


Add iOS Device to the List of Devices 


Generate iOS Provisioning Profiles and Add Provisioning Profiles to Xcode 


Configure PHP Scripts for Sending Push Notifications


Configure AppDelegate Swift File to Register for Push Notifications 


Configure App Transport Security in Info.plist File


Register App to Receive Push Notifications and Store Device Details in Database

 

Create and Send Push Notification From a PHP Script

Display Push Notification in the App With Swift Code 

 

And if you did not check my little kindle book on Amazon, I will be very happy if you do so and provide me with some feedback :). Here a link: goo.gl/dIBKpv

Thank you!

P.S. Other blog posts of mine that make use of PHP & MySQL:

UISegmentedControl with UITableView example in Swift. Part 2.

UICollectionView example in Swift

Case Insensitive Search with Swift, PHP and MySQL

Email Verification Feature with Swift, PHP and MySQL

Image Upload with Progress Bar example in Swift

Image upload example with Swift and PHP

Integrate your mobile app with WordPress users table

Store user information in MySQL database

Send HTTP POST Request example using Swift and PHP

  • Rodrigo Vieira

    Great!

  • Punur

    awesome tutorial

  • tat

    if my Certificates is red color.
    can i push Notifications

    • What does it say in red? Does it say that certificate has expired?

      • tat

        Yes. i do know why.
        i buy the apple development account 1 month ago.
        when i download the aps_development.cer file. and then click the cer file the cer has some red color words.
        however, my certificate has not expired.

        https://uploads.disquscdn.com/images/f5dddc88ff6e3e733760200aaabd711d2999b8fa6bcdd215cff43d368e4d60bd.jpg

        • @disqus_1t91HcTvX6:disqus Try this. Open keychain and from the left side bottom section select Certificates. You will get list of your certificates displayed. Then, from the top menu, select View->Show expired certificates. Will it display any expired certificates? Anything in red?

          • tat

            Yes i follow you instruction.
            i find 14 files in red.

          • You need to delete those that are in red. They have expired.

  • Jônatas

    Great and very well explained series!

  • Jônatas

    Hi, is that possible to publish the samples developed in the videos?

  • Annabel Teng

    Is it possible to have an objective c version as well?

  • soma mridha

    Nice tutorial. Pushify is also offering Unlimited Free Browser Push Notifications to Unlimited Subscribers by which you can connect with your customers easily even customer not in your website. Notifications will deliver to your Customers Mobile and Desktop. We are offering Unlimited REST API calls, Geo-Targeting, Scheduled Notifications, Free Plugins to CMS & e-commerce, RSS 2 Push and many features for free. To know more just visit -www.pushify.com

  • Enrique Yc

    Hi there im tryng to use the server php for send the notifications but i get this issue “Certificate is insecure”, im using the same certificate for both , production and developer, can us help men?

  • Enrique Yc

    Hi there im tryng to use the server php for send the notifications but i get this issue “Certificate is insecure”, im using the same certificate for both , production and developer, can us help men?

    • Hi! I am so so sorry. I have just noticed this comment of yours. I guess you have already found a solution to your problem with Certificate being insecure?

  • Edmund Siah

    Hi Kargopolov,
    I have us your tutrorial & it works, however there is one funny error. whenever i try to click on samples.php via browser, it does send notification, however, it keeps connecting & send more than one notification. I used the exact samples.php as per download. Maybe you can advise me whats happening?

    • 🙂 may be you do send it twice? 🙂 Can you share a screen shot of your code may be?

    • Edmund Siah

      Hi Kargopolov,
      thanks for replying to my tread. I manage to find the problem & solution.
      Problem: I am using webhost000.server which Port 2195 & 2196 is not open. Due to that, I am having connection problem & causing the notification to run on a continuous loop.

      Solution: I manage to contact the server administrator to open these 2 TCP ports for me. After doing that, its works like a charm :).

      Hopefully this will be helpful to whoever facing the same problem as me.

      • Very good! Thank you for your message!

  • Daniel Jones

    Hi there! I’m enjoying the tutorial, but is there an update for IOS10’s UNUserNotificationCenter? The existing code is obsolete now and I am having trouble updating the pushSound, pushBadge and pushAlert variables.

  • Must Mo

    Hi kargopolov sir
    i have problem about the developmentPushCertificate.pem
    when i set 400 it can not send push
    but 777 it can work.
    how can i solve the problem thanks

    • Must Mo

      i am using EC2 Ubuntu 16.4

  • Tzu-Nung Lee

    hi Thanks for the videos. It’s very useful!

    I have some questions.
    1. How to correctly send push notifications to all the devices?
    2. I try to set newMessage(null)— to send to all the devices, but all the messages couldn’t be sent instantly. They all appear to be queued. It usually takes 10-15 minutes to send them out.

    Thanks
    Ethan