1.6.21 • Published 4 years ago

pushbots-cordova-plugin v1.6.21

Weekly downloads
28
License
Apache 2.0
Repository
github
Last release
4 years ago

phonegap/Cordova Plugin for Pushbots

PushBots' official module for Phonegap/Cordova

https://www.pushbots.help/install-pushbots-in-your-app-or-website/cordova-phonegap-and-phonegap-build/integrating-pushbots-in-your-cordovaphonegap-app

Installation

cordova plugin add pushbots-cordova-plugin --save

Usage

  1. Intialize Pushbots in deviceReady section:

Firebase credentials: https://www.pushbots.help/en/articles/498201-the-google-part-firebase-credentials

window.plugins.PushbotsPlugin.initialize("5f4bb916f2e7634ba83f1b93", {"android":{"sender_id":"SENDER_ID", "fcm_app_id":"FCM_APP_ID", "web_api_key":"WEB_API_KEY", "project_id":"PROJECT_ID"}});

// Only with First time registration
window.plugins.PushbotsPlugin.on("registered", function(token){
	console.log("Registration Id:" + token);
});

//Get user registrationId/token and userId on PushBots, with evey launch of the app even launching with notification
window.plugins.PushbotsPlugin.on("user:ids", function(data){
	console.log("user:ids" + JSON.stringify(data));
});
  1. Methods to use it:
window.plugins.PushbotsPlugin.setAlias("Test");
window.plugins.PushbotsPlugin.removeAlias();

//Add or remove Single tag
window.plugins.PushbotsPlugin.tag("tag1");
window.plugins.PushbotsPlugin.untag("tag1");

//Add or remove array of tags
window.plugins.PushbotsPlugin.setTags(["tag1"]);
window.plugins.PushbotsPlugin.removeTags(["tag1"]);

window.plugins.PushbotsPlugin.debug(true);

//Track event
window.plugins.PushbotsPlugin.trackEvent("added_to_cart");

//ShareLocation with prompting
window.plugins.PushbotsPlugin.shareLocationPrompt(true);
//Sharelocation without prompting
window.plugins.PushbotsPlugin.shareLocation(true);
//Set log level with alert
window.plugins.PushbotsPlugin.setLogLevelWithUI({"logLevel":3, "showAlert":true});
//set log level without alert
window.plugins.PushbotsPlugin.setLogLevel(3);


//unsubscribe user from receiving notifications
window.plugins.PushbotsPlugin.toggleNotifications(false);

//iOS only

//Reset Badge
window.plugins.PushbotsPlugin.resetBadge();
//Set badge
window.plugins.PushbotsPlugin.setBadge(10);
//Increment badge count
window.plugins.PushbotsPlugin.incrementBadgeCountBy(1);
//Decrement badge count
window.plugins.PushbotsPlugin.decrementBadgeCountBy(10);
  1. To handle Notification events:
// Should be called once app receive the notification [foreground/background]
window.plugins.PushbotsPlugin.on("notification:received", function(data){
	console.log("received:" + JSON.stringify(data));
	
	//iOS: [foreground/background]
	console.log("notification received from:" + data.cordova_source);
	//Silent notifications Only [iOS only]
	//Send CompletionHandler signal with PushBots notification Id
	window.plugins.PushbotsPlugin.done(data.pb_n_id);
});

window.plugins.PushbotsPlugin.on("notification:clicked", function(data){
	// var userToken = data.token; 
       // var userId = data.userId;
  	console.log("clicked:" + JSON.stringify(data));
});

window.plugins.PushbotsPlugin.setName("name");
window.plugins.PushbotsPlugin.setFirstName("first name");
window.plugins.PushbotsPlugin.setLastName("last name");
window.plugins.PushbotsPlugin.setEmail("email");
window.plugins.PushbotsPlugin.setGender("M");
window.plugins.PushbotsPlugin.setPhone("+2100");

Phonegap DEPRECARTED

https://blog.phonegap.com/update-for-customers-using-phonegap-and-phonegap-build-cc701c77502c

1.6.21

4 years ago

1.6.20

4 years ago

1.6.15-rc5

4 years ago

1.6.15-rc6

4 years ago

1.6.15-rc7

4 years ago

1.6.15-rc8

4 years ago

1.6.15-rc4

4 years ago

1.6.19

4 years ago

1.6.17

4 years ago

1.6.18

4 years ago

1.6.15-rc2

4 years ago

1.6.15-rc3

4 years ago

1.6.16

4 years ago

1.6.15-rc1

4 years ago

1.6.15

4 years ago

1.6.14

4 years ago

1.6.13

4 years ago

1.6.12

5 years ago

1.6.11

5 years ago

1.6.10

5 years ago

1.6.9

5 years ago

1.6.8

5 years ago

1.6.7

5 years ago

1.6.6

5 years ago

1.6.5

5 years ago

1.6.4

5 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.0

6 years ago

1.5.15

6 years ago

1.5.14

6 years ago

1.5.13

6 years ago

1.5.12

6 years ago

1.5.11

6 years ago

1.5.10

6 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.9

6 years ago

1.4.8

6 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

8 years ago

1.3.9

8 years ago

1.3.8

8 years ago

1.3.7

8 years ago

1.3.6

8 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.8

9 years ago

1.2.7

9 years ago