Apache Cordova / Phonegap Push Notification Tutorial – Part 1

Want create site? Find Free WordPress Themes and plugins.

In this phonegap push notification tutorial we’ll see how to setup Google Project

What is Push Notification ?

Push notifications are simple messages from apps installed on a device that wake up the handset and alert the user with a message displayed on the home or lock screen. Push notifications are widely used on all mobile devices as a way to inform or update the user.



How to send push Notification using Phonegap / Apache Cordova ?

  1. Creating a Google Project
  2. Working with Mobile for receiving Push Notification
  3. Working with PHP for Sending Push Notification

NOTE : This Tutorial has been written for android platform, it may not work with other platforms

Creating a new Google Project




  • Create New Project from your dashboard



3. Add a Project Name ( you can choose anything you want)




4. Copy the sender ID, here the Sender ID is 721393051486 ( please do not use this ID, may not work)


5. For Enabling GCM for a project,

  • Choose API
  • Search “cloud messaging”
  • Click Google Messaging for android


6. Click Enable API


7. For Creating Server Key ( which is used for sending Push notification using PHP)

  • Click Credential from your left menu
  • Click Add credential button
  • Click API key, it will open a new popup window for creating server key
  • Click Next, you can get Server key









Read More

Did you find apk for android? You can find new Free Android Games and apps.
  • max


    good job!

    I’m tring to follow your tutorial but I have some problems:

    1st test:
    in the App don’t appear nothing, but in the console I found :
    “Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin….”

    So I added to config.xml:

    and in index.html:

    2nd test:
    Now the error in the console is:

    Failed to load resource: net::ERR_FILE_NOT_FOUND
    index.html:15 Device Ready
    index.html:20 eDxxeNTZrDw:APA91bHBvdxSb0l3S5LyKPPXKENQt_BLB_yOR94CxbKVeVrQjZPhzjkfPXQUcG6ileMXveIbvlFIz2Rk9-t80cnVkiYwRDvYZYDHAArQjeYIBGJXuLKrZKI8SET4TCZMPD4tyLCXt_Z7
    cordova.js:310 Error in Success callbackId: PushNotification1219890219 : ReferenceError: $ is not defined
    cordova.js:312 Uncaught ReferenceError: $ is not defined

    I think that GCM is working but the app can’t display the code. It’s correct?

    In google I’ve found here:

    hanh le say: onNotification must be have scope in window.
    window.onNotification = function(){


    but I don’t undestand how to modify your code. Could you help me, please?

    Any help is apreciated! 🙂


  • max

    …and following the 3th step, I received my first push message! 🙂
    TNX! for your tutorial!

  • Thank you very much for this great tutorial.
    I use PhoneGap Build and I’ve done some edit into config.xml file.
    You are awesome!!!

  • Kunal Soneta

    can same thing work for ios?

    • This won’t work on iOS, That’s different

      • Angelo Hernandez

        do you have any tutorials for ios?

  • Bruno Delfim

    How to send push for ios with phonep-plugin-push ?

MyMail WordPress Plugin free
Save $50 USD on Ionic Firebase Chat Source CodeEXPLORE