Skip to content

triztian/cordova-parse-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cordova Parse.com Plugin

Cordova 3.5.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

Parse iOS SDK 1.3.0
Parse Android SDK 1.6.0

This plugin exposes the four native Android API push services to JS:

Installation

Pick one of these two commands:

phonegap local plugin add https://github.com/Triztian/cordova-parse-plugin
cordova plugin add https://github.com/Triztian/cordova-parse-plugin

Build

Android

If the application seems to crash after pausing it; try adding the following preference to your cordova config.xml

<preference name="KeepRunning" value="false"/>

iOS

If you get the error of "undefined symbols for architecture " and the missing symbols appear to be related to the Facebook SDK. You will have to modify the build flags for the iOS project, remove the "-ObjC" flag from the platforms/ios/<YourProject>.xcodeproj/project.pbxproj file, somewhere along line 560, the first after the start of the "XCBuildConfiguration" section.

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.

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

<script type="text/javascript>
	parsePlugin.initialize(appId, clientKey, function() {
		alert('success');
	}, function(e) {
		alert('error');
	});
  
	parsePlugin.getInstallationId(function(id) {
		alert(id);
	}, function(e) {
		alert('error');
	});
	
	parsePlugin.getSubscriptions(function(subscriptions) {
		alert(subscriptions);
	}, function(e) {
		alert('error');
	});
	
	parsePlugin.subscribe('SampleChannel', function() {
		alert('OK');
	}, function(e) {
		alert('error');
	});
	
	parsePlugin.unsubscribe('SampleChannel', function(msg) {
		alert('OK');
	}, function(e) {
		alert('error');
	});
</script>

Compatibility

Phonegap > 3.0.0
Cordova > 3.0.0

About

Apache Cordova 3.5.0 plugin for Parse.com push service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 96.9%
  • Java 1.4%
  • CSS 1.2%
  • JavaScript 0.5%