Skip to content

tobilektri/phonegap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phonegap/Cordova Plugin for Pushbots

PushBots' official module for Phonegap/Cordova

https://pushbots.com/developer/docs/phonegap-sdk-integration

Installation

This requires phonegap/cordova CLI 5.0+

cordova plugin add pushbots-cordova-plugin

##Usage

  1. Intialize Pushbots in deviceReady section:
window.plugins.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
window.plugins.PushbotsPlugin.on("registered", function(token){
	console.log("Registration Id:" + token);
});

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

//iOS only

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

// Should be called once the notification is clicked
window.plugins.PushbotsPlugin.on("notification:clicked", function(data){
	console.log("clicked:" + JSON.stringify(data));
});

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 54.5%
  • Java 28.5%
  • JavaScript 17.0%