Catapush Cordova / PhoneGap / Ionic Library Documentation

Set of tools to easily implement Catapush in your PhoneGap / Cordova / Ionic hybrid project.


The library can be downloaded here: full version, minified version. If you are using npm (package.json) you can install it with (you can use this also for Ionic):  

npm install catapush_phonegap


Load the library and its dependencies:

<link type="text/css" href="catapush-widget.css" rel="stylesheet">

<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="catapush.js"></script>
<script type="text/javascript" src="catapush-widget.js"></script>
<script type="text/javascript" src="catapush-phonegap.js"></script>

create a div container

<div id="catapush-widget"></div>

Load the widget, the library and connect using an existing Catapush user:

    var catapush = Catapush.get();
        'appKey': 'yourAppKey',
        'platform' : Catapush.PLATFORM.ANDROID, // Platform as defined in Catapush Library
        'user' : 'userIdentifier',
        'password' : 'userPassword',
        'instance': this.catapush

Use the api provided by the library to add notification handlers and more.



  • getPlatformId - obtain current platform id as required by Catapush Api
  • updateToken (token) - update current push token using Catapush API
  • setupPush - setup Push notification through plugin phonegap-plugin-push
  • getOnForeground - returns true if app is currently in foreground
  • alert (message) - show simple alerts, using Toastr when possible
  • starts - starts the plugin


  • onShow - triggered when application is put on foreground
  • onHide - triggered when application is removed from foreground (closed or hidden)


The app depends on four libraries:

  • jQuery - v. 1.7.0 and higher - a fast, small, and feature-rich JavaScript library;
  • Strophe.js - v. 1.2.6 and higher - an XMPP library for JavaScript. Its primary purpose is to enable web-based, real-time XMPP applications that run in any browser;
  • ydn-db - v. 0.9.2 and higher - Javascript database library for IndexedDB, WebSQL and WebStorage;
  • catapush - v. 0.1 and higher - Main Catapush Library;
  • catapush jquery widget - v. 0.1 and higher - Catapush jQuery Widget.

Can also been installed using npm (package.json):

  "dependencies": {
    "jquery": "*",
    "strophe.js": "*",
    "ydn.db": "*",
    "catapush": "*",
    "catapush_widget": "*"

Catapush Widget is not mandatory, but represents an easy way to show messages.

Some cordova packages are also needed:

Full Example


A full example, based on PhoneGap, is available here: