HTML
Need help with phonegap-parse-plugin?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
avivais

Description

Phonegap 3.0.0 plugin for Parse.com push service

196 Stars 328 Forks 82 Commits 66 Opened issues

Services available

Need anything else?

Phonegap Parse.com Plugin

Phonegap 3.0.0 plugin for Parse.com push service

Using Parse.com's REST API for push requires the installation id, which isn't available in JS

This plugin exposes the four native Android API push services to JS: * getInstallationId * getSubscriptions * subscribe * unsubscribe

Installation

Pick one of these two commands:

phonegap local plugin add https://github.com/benjie/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY
cordova plugin add https://github.com/benjie/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY

Initial Setup

Once the device is ready, call

parsePlugin.initialize()
. This will register the device with Parse, you should see this reflected in your Parse control panel. After this runs you probably want to save the installationID somewhere, and perhaps subscribe the user to a few channels. Here is a contrived example.

(Note: When using Windows Phone, clientKey must be your .NET client key from Parse. So you will need to set this based on platform i.e. if( window.device.platform == "Win32NT"))

parsePlugin.initialize(appId, clientKey, function() {

parsePlugin.subscribe('SampleChannel', function() {

    parsePlugin.getInstallationId(function(id) {

        /**
         * Now you can construct an object and save it to your own services, or Parse, and corrilate users to parse installations
         * 
         var install_data = {
            installation_id: id,
            channels: ['SampleChannel']
         }
         *
         */

    }, function(e) {
        alert('error');
    });

}, function(e) {
    alert('error');
});

}, function(e) { alert('error'); });

Usage

Quirks

Android

Parse needs to be initialized once in the

onCreate
method of your application class using the
initializeParseWithApplication
method.

If you don’t have an application class (which is most likely the case for a Cordova app), you can create one using this template:

package my.package.namespace;

import android.app.Application; import org.apache.cordova.core.ParsePlugin;

public class App extends Application {

@Override
public void onCreate() {
    super.onCreate();
    ParsePlugin.initializeParseWithApplication(this);
}

}

And add your application name to

AndroidManifest.xml
:
...

Compatibility

Phonegap > 3.0.0

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.