Skip to content

remarkablelabs/phonegap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phonegap

PushBots' official module for Phonegap

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

##Installation

cordova plugin add com.pushbots.push

##Usage

  1. Intialize Pushbots in deviceReady section:
onDeviceReady: function() {
	app.receivedEvent('deviceready');

	if( PushbotsPlugin.isiOS() ){
		PushbotsPlugin.initializeiOS("PUSHBOTS_APP_ID");
	}
	
	if( PushbotsPlugin.isAndroid() ){
		PushbotsPlugin.initializeAndroid("PUSHBOTS_APP_ID", "GCM_SENDER_ID");
	}
}
  1. Methods to use it:
//iOS && Android
//Set Alias
PushbotsPlugin.setAlias("alias");
//Tag Device
PushbotsPlugin.tag("tag");
//unTag device
PushbotsPlugin.untag("tag1");
//Enable debug mode
PushbotsPlugin.debug(true);
//Unregister device from Pushbots
PushbotsPlugin.unregister();
//Get device token
PushbotsPlugin.getToken(function(token){
	console.log(token);
});

//iOS only
//Reset Badge
PushbotsPlugin.resetBadge();
//Set badge
PushbotsPlugin.setBadge(10);
  1. To handle Notifications payload on Click [Android only]

Add this method to index.js

 function myMsgClickHandler(msg){
     console.log("Clicked On notification" + JSON.stringify(msg));
     alert(JSON.stringify(msg));
 }

Then set Notification click event:

PushbotsPlugin.onNotificationClick(myMsgClickHandler);

About

PushBots' official module for Phonegap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 52.1%
  • Java 32.6%
  • JavaScript 15.3%