Skip to content

surfyst/phonegap-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phonegap/Cordova Plugin for Pushbots

PushBots' official module for Phonegap/Cordova

https://pushbots.com/developer/docs/phonegap

Installation

This requires phonegap/cordova CLI 5.0+

cordova plugin add pushbots-cordova-plugin

##Usage

  1. Intialize Pushbots in deviceReady section:
var Pushbots = PushbotsPlugin.initialize("PUSHBOTS_APPLICATIONID", {"android":{"sender_id":"SENDER_ID"}});

// First time registration
// This will be called on token registration/refresh with Android and with every runtime with iOS
Pushbots.on("registered", function(token){
	console.log("Registration Id:" + token);
});

Pushbots.getRegistrationId(function(token){
	console.log("Registration Id:" + token);
});
  1. Methods to use it:
Pushbots.updateAlias("Test");
Pushbots.tag("tag1");
Pushbots.untag("tag1");
Pushbots.debug(true);
Pushbots.unregister();

//iOS only

//Reset Badge
Pushbots.resetBadge();
//Set badge
Pushbots.setBadge(10);
  1. To handle Notification events:
// Should be called once app receive the notification
Pushbots.on("notification:received", function(data){
	console.log("received:" + JSON.stringify(data));
});

// Should be called once the notification is clicked
// **important** Doesn't work with iOS while app is closed, will be fixed in 1.3.1
Pushbots.on("notification:clicked", function(data){
	console.log("clicked:" + JSON.stringify(data));
});

About

PushBots' official module for Phonegap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 55.7%
  • Java 27.9%
  • JavaScript 16.4%