Push Notifications With Apache Cordova

Push Notification with Hybrid appThis is a small tutorial which show how to implement push notifications feature for your hybrid mobile app built with Cordova-based technology (Phonegap, Apache Cordova, Ionic framework).

Push notifications depends not only on your application code, but also require some other stuff, such as server setup for sending notifications and API keys/certificates setup.

I’ll describe how to setup push notifications for iOS and Android platforms without any pain.

Prerequisites

Android

  • Google Project ID (project can be created on http://console.developers.google.com)
  • API Key for Google Cloud Messaging (the same link, choose “Enable API” section and create server key)

iOS

  • iOS developer account
  • iOS app ID, can be configured via “App Identifiers” on https://developer.apple.com via “Member center”
  • Push certificate. Separate certificates are required for development and production environments

Application side

  • Install plugin for Cordova

  • Initialize push notifications in “deviceready” event handler or $ionicPlatform.ready handler. Setup event handlers.

Important notes

  • Push notifications doesn’t work on iOS emulator, you need a real device for notifications testing.
  • To test push notifications with Android emulator, please create virtual device by selecting target with “Google Play Services” included. You also may need to login into your Google account in device settings.

Setting up server for push notification send

Keep an eye on my blog, this article is coming soon!

UPDATE: How to setup server-side for push notifications

Leave a Reply

Your email address will not be published. Required fields are marked *