ParsePush

Parse Push plugin implementation
StreetHub0.0.22
platforms: ios
$ cordova plugin add com.phonegap.plugins.parsePush

Parse Push Notifcations for Phonegap / Cordova

Very simple implementation exposing basic functionality. Fast setup of Parse Push Notifications currently only for iOS.

Installation

cordova -d plugin add https://github.com/StreetHub/phonegap-parsepush-plugin.git --variable PARSE_APPID="APP_ID" --variable PARSE_KEY="KEY"

  • PARSE_APPID - Pass on the APP_ID set in your Parse dashboard
  • PARSE_KEY - Pass your parse key

Installing the plugin will automagically add the APPID and KEY to the .plist of the app. It will also hook onto the UIApplicationDidFinishLaunchingNotification and initialise Parse Push Notifications. This will happen when you build the project with the plugin installed so make sure you've setup your signing / provisioning profile in your build settings. Here's a quick tutorial from Parse explaining how: https://www.parse.com/tutorials/ios-push-notifications

On build (cordova build ios) the Parse SDK (parse-sdk.js) and Cordova Interface (parse-push.js) are injected into your index.html. When the Cordova Interface is loaded it attaches the parsepush object to window.plugins which you can then use to access the exposed native functions

Usage

var Push = window.plugins.parsepush;
// Push.init() reserved for config
Push.init();

API

  • init(): Reserved function for later configuration - doesn't really do much currently

  • cancelAllLocalNotifications(): Removes all local Notifications and sets BadgeNumber to 0

  • subscribeToChannel(): Subscribes current PFInstallation to a specific channel. Currently only takes one channel at a time (str)

TODO

  1. Add local push notification support - currently you can only push remotely
  2. Handle offline state
  3. Add Android
  4. Add tests. Lots of tests