Allows you to integrate AdColony monetization platform with your Apache Cordova app.
iOS SDK version is 4.1.0
Android SDK version is 4.1.0
Please make sure that you read the AdColony Project setup guides for both Android and iOS if you're building on both platforms.
All the documentation is available from here:
This update integrates AdColony using a podspec in the plugin definition
$ cordova plugin add cordova-plugin-adcolony
See the AdColonyDemoApp code for how to configure and provide an APP_ID and a ZONE_ID within your JavaScript
You will need to manually merge the contents of the file platforms/android/proguard-adcolony.txt to your existing project proguard-project.txt file (I need to figure out how to do this via a script still)
Please note that you must follow steps 2 onwards in the AdColony Project Setup notes (https://github.com/AdColony/AdColony-iOS-SDK/wiki/Project-Setup)
Initial method wich connects to AdColony.
Set App Options.
Argument | Type | Description |
---|---|---|
options | Object | JSON Array typically with ONE element a JSON object with the app options |
Initial method wich connects to AdColony.
Argument | Type | Description |
---|---|---|
appID | string | the appID of your app in AdColony Dashboard |
zoneIDs | [strings] | array of your ad zones ids |
options | Object | arapp options defined here |
Set App Options.
Argument | Type | Description |
---|---|---|
options | Object | JSON Array typically with ONE element a JSON object with the options. Options defined here |
Note that I use the following strings from the Android SDK for cross-platform compatability
orientation
app_orientation
origin_store
disable_logging
user_id
gdpr_required
consent_string
test_mode
multi_window_enabled
mediation_network
mediation_network_version
plugin
plugin_version
keep_screen_on
Set Ad options. options - JSON Array typically with ONE element a JSON object with the options. Options defined here
Set User meta-data for ad retrieval. Calling this sets the user metadata for all future ad requests metadata - JSON Array typically with ONE element a JSON object with the user meta-data. User meta-data defined here
Argument | Type | Description |
---|---|---|
metadata | Object | JSON Array typically with ONE element a JSON object with the user meta-data |
Request ad with given zoneID
Argument | Type | Description |
---|---|---|
zoneId | String | Your ad zone id |
Request ad with current zoneID
Register the given Javascript method to handle rewards (Demo uses 'AdColony.onRewardReceived'
Argument | Type | Description |
---|---|---|
rewardHandler | Function | Reward handler |
After ad is loaded you can show it by calling this method.
document.addEventListener('ConfigureSuccess', () => {
console.log('AdColonyPlugin: Configuration successfully completed.');
});
document.addEventListener('AdColonyRequestSubmitted', () => {
console.log('AdColonyPlugin: Interstitial ad requested.');
});
document.addEventListener('AdColonyRequestFilled', () => {
console.log('AdColonyPlugin: Interstitial ad loaded.');
});
document.addEventListener('AdColonyRequestNotFilled', (error) => {
console.log('AdColonyPlugin: Request interstitial failed with error: ' + error);
});
document.addEventListener('AdColonyRequestOpened', () => {
console.log('AdColonyPlugin: Interstitial ad opened.');
});
document.addEventListener('AdColonyRequestClosed', () => {
console.log('AdColonyPlugin: Interstitial ad closed.');
});
document.addEventListener('AdColonyRequestExpiring', () => {
console.log('AdColonyPlugin: Interstitial ad expiring.');
});
let appID = 'AdColonyAppID';
let zoneIDs = ['myZoneID1', 'myZoneID2'];
let options = null;
AdColony.configureWithAppID(appID, zoneIDs, options);
document.addEventListener('ConfigureSuccess', () => {
AdColony.requestInterstitialInZone(zoneIDs[0]);
});
document.addEventListener('AdColonyRequestFilled', () => {
AdColony.showWithPresentingViewController();
});
document.addEventListener('AdColonyRequestClosed', () => {
console.log('AdColonyPlugin: Interstitial ad closed.');
});
document.addEventListener('AdColonyRequestNotFilled', (error) => {
console.log('AdColonyPlugin: Request interstitial failed with error: ' + error);
});
Also, Ferdil created great full working demo.
If you have saved some time using our work, do consider donating us something :) All donations I'll devide between all contributors.