npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iadbox-cordova-plugin

v1.0.6

Published

iadbox Cordova Plugin

Downloads

3

Readme

iadbox Cordova Plugin

Add support for iadbox to your Cordova and Phonegap based mobile apps.

We currently support Android and iOS platforms.

How do I install it?

If you're like me and using CLI:

cordova plugin add iadbox-cordova-plugin

or

cordova plugin add https://github.com/iadbox/iadbox-cordova-plugin.git

or

phonegap local plugin add https://github.com/iadbox/iadbox-cordova-plugin.git

If you want to see a full example of a simple app using this plugin you can check: iadbox-cordova-app.

How do I use it?

Here is a demonstration of the main functions.

document.addEventListener('deviceready', function() {
	var topbar_color = '#669900';
	var topbar_text = 'Messages';
	var affiliateId = 'affid'; //your affiliate id
	var userId = 'someuserid'; //your app user id
	var pushId = 'obtain push registration ID'; //set it to blank to disable notifications
	window.plugins.iadbox.customize(topbar_color, topbar_text);
	window.plugins.iadbox.authenticateUser(affiliateId, userId, pushId,	
		function() { console.log('Success') }, 
		function(message) { console.log('Ouch!!!' + message)}
	);
                    
}, false);

// To open the inbox
window.plugins.iadbox.openInbox();

// To get the number of unread messages
window.plugins.iadbox.getBadge(
	function(count){ console.log(count + 'unread messages'); }, 
	function(message) { console.log('Ouch!!!' + message); });

How to integrate push notifications?

The easiest way to integrate our notifications feature is to use phonegap-plugin-push plugin. Follow its instructions to set it up.

Here you have an example on how to use it:

var pushId = "";
var pushNotificationPlugin = PushNotification.init({
    android: {
        senderID: "YOUR SENDER ID"
    },
    ios: {
        alert: "true",
        badge: "true",
        sound: "true"
    }
});

pushNotificationPlugin.on('error', function(e) {
    console.error(e.message);
    authenticateUser();
});

pushNotificationPlugin.on('registration', function(data) {
    pushId = data.registrationId;
    console.log("Regitration pushId: " + pushId);
    authenticateUser();
});

pushNotificationPlugin.on('notification', function(data) {
    // data.message,
    // data.title,
    // data.count,
    // data.sound,
    // data.image,
    // data.additionalData
});

Our notification payload has the following format:

{
	"message":"You have 1 new message.",
	"additionalData":{"action":"inbox"}
}

The previous notification payload purpose is to open our Inbox, you should do something like:

pushNotificationPlugin.on('notification', function(data) {
    if(data.additionalData.action === "inbox"){
    	window.plugins.iadbox.openInbox();
	}
});

How to show unread messages in your App's badge?

Here you have an example using cordova-plugin-badge:

window.plugins.iadbox.getBadge(
	function(count) {
        console.log("updateMessageCountBadge: " + count);
        cordova.plugins.notification.badge.set(count);
    }, 
    function(message) { console.log('Ouch!!!' + message); });