Present AdColony Ads in Mobile App/Games natively from JavaScript.
Compatible with:
- Cordova CLI, v3.5+
The repo location has changed. Future-proof by updating your remote:
git remote set-url origin [email protected]:affinityis/cordova-adcolony-plugin.git
If using with Cordova CLI:
cordova plugin add https://github.com/affinityis/cordova-adcolony-plugin
Step 1: Prepare your AdColony App Id for your app on AdColony's client site.
var config = {
ios : {
app_id:"ios_app_id",
zone_ids: ["ios_zone_id"]
},
android : {
app_id:"android_app_id",
zone_ids: ["android_zone_id"]
}
};
// select the right Ad Id according to platform
var setup = (/(android)/i.test(navigator.userAgent)) ? config.android : config.ios;
// Pass in an object with additional configuration
AdColony.initialize(setup.app_id, setup.zone_ids, {
debug: true, // iOS only
optionString: "version:1.0,store:google", // Android only
});
Step 2: Create a video ad with single line of javascript
AdColony.showVideoAd( zoneId );
AdColony.showV4VCVideoAd( zoneId );
Methods:
// Call before using API
initialize(appId, zoneIds, options, success, fail);
// Video ads
showVideoAd(zoneId);
showV4VCVideoAd(zoneId);
// Cancel all ads
cancelAd();
// For native ad (coming)
createNativeAd(adId, success, fail);
removeNativeAd(adId);
setNativeAdClickArea(adId, x, y, w, h);
The APIs, Events and Options are detailed documented.
Read the detailed API Reference Documentation English.
If encounter problem when using the plugin, please read the FAQ first.