Appodeal Cordova Plugin
This is an official Appodeal Cordova plugin, created to support Appodeal SDK with Apache Cordova.
android-support-v7-recyclerview
(it is needed for native ads witch is not supported by Cordova plugin) into libs/Android
.aar
folder should be unzipped and composed into ant libraries, you can check how it should be structured on existing libraries in Android folder.plugin.xml
file, scroll down to the end of android platform tag, edit source-file
tags (it should be equal to the jar names, you’ve put into libs/Android
folder) and framework
tags (should be equal to the library folders, you’ve composed from aar libraries).AndroidManifest.xml
tags from Appodeal Android Docs page and replace old with new inside <config-file parent="/manifest/application" target="AndroidManifest.xml">
.Appodeal.framework
with new one and put Resources
folder if exists into libs/iOS/Appodeal.<platform name="ios">
and check system frameworks for any changes due to changes in 3 Step of 5.3 Manual Integration in Appodeal iOS Doc page.<framework custom="true" src="libs/iOS/Appodeal/Appodeal.framework"></framework>
in plugin.xml up to </platform>
close tag. Resources
folder. Add all resources from Resources
folder of unzipped iOS SDK manually after <framework custom="true" src="libs/iOS/Appodeal/Appodeal.framework"></framework>
, for example:
<resource-file src="libs/iOS/Appodeal/Resources/MPCloseBtn.png"></resource-file>
Simply go to the project folder over console/terminal and run there following command:
cordova plugin add https://github.com/appodeal/appodeal-cordova-plugin.git
Google Play Services (v10+) already included to plugin dependencies.
If you have issues while installing plugin, follow the Command-line Interface Guide.
Minimum OS requirements:
Appodeal Cordova Plugin includes:
Ad types can be combined using “|” operator. For example Appodeal.INTERSTITIAL | Appodeal.NON_SKIPPABLE_VIDEO.
To initialize SDK for INTERSTITIAL ad type, call the following code:
var appKey = "e7e04e54ae0a8d28cff2f7e7e7d094e78b2a09743be2cc4a";
Appodeal.disableLocationPermissionCheck();
Appodeal.initialize(appKey, Appodeal.INTERSTITIAL);
Appodeal.initialize(appKey, Appodeal.INTERSTITIAL)
Appodeal.initialize(appKey, Appodeal.REWARDED_VIDEO)
Appodeal.initialize(appKey, Appodeal.NON_SKIPPABLE_VIDEO)
Appodeal.initialize(appKey, Appodeal.INTERSTITIAL | Appodeal.NON_SKIPPABLE_VIDEO)
Appodeal.initialize(appKey, Appodeal.BANNER)
To display ad you need to call the following code:
Appodeal.show(adTypes);
Appodeal.show(Appodeal.INTERSTITIAL)
Appodeal.show(Appodeal.REWARDED_VIDEO)
Appodeal.show(Appodeal.NON_SKIPPABLE_VIDEO)
Appodeal.show(Appodeal.INTERSTITIAL | Appodeal.NON_SKIPPABLE_VIDEO)
Appodeal.show(Appodeal.BANNER_BOTTOM)
Appodeal.show(Appodeal.BANNER_TOP)
Also it can be used in this way, to get boolean value if ad was successfully shown:
Appodeal.show(adTypes, function(result) {
// result is a boolean value, that is indicates whether show call was passed to appropriate SDK
});
To check if ad type was loaded, use following code:
Appodeal.isLoaded(adTypes, function(result){
// result returns bool value
});
To hide banner you need to call the following code:
Appodeal.hide(Appodeal.BANNER);
To set Interstitial callbacks, use following code:
Appodeal.setInterstitialCallbacks( function(container) {
if (container.event == 'onLoaded') {
console.log("Appodeal. Interstitial. " + container.event + ", isPrecache: " + container.isPrecache );
// your code
} else if (container.event == 'onFailedToLoad') {
// your code
} else if (container.event == 'onShown') {
// your code
} else if (container.event == 'onClick') {
// your code
} else if (container.event == 'onClosed') {
// your code
}
});
To set Banner callbacks, use following code:
Appodeal.setBannerCallbacks( function(container) {
if (container.event == 'onLoaded') {
console.log("Appodeal. Banner. " + container.event + ", height: " + container.height + ", isPrecache: " + container.isPrecache);
// your code
} else if (container.event == 'onFailedToLoad') {
// your code
} else if (container.event == 'onShown') {
// your code
} else if (container.event == 'onClick') {
// your code
}
});
To set Rewarded Video callbacks, use following code:
Appodeal.setRewardedVideoCallbacks( function(container) {
if (container.event == 'onLoaded') {
// your code
} else if (container.event == 'onFailedToLoad') {
// your code
} else if (container.event == 'onShown') {
// your code
} else if (container.event == 'onFinished') {
// container also returns "name" and "amount" variables with reward amount and currency name you have set for your application
console.log( "Appodeal. Rewarded. " + container.event + ", amount: " + container.amount + ", name: " + container.name);
// your code
} else if (container.event == 'onClosed') {
// container also returns "finished" variable with boolean value for indicating if video was finished
console.log("Appodeal. Rewarded. " + container.event + ", finished: " + container.finished);
// your code
}
});
To set Non Skippable Video callbacks, use following code:
Appodeal.setNonSkippableVideoCallbacks( function(container) {
if (container.event == 'onLoaded') {
// your code
} else if (container.event == 'onFailedToLoad') {
// your code
} else if (container.event == 'onShown') {
// your code
} else if (container.event == 'onFinished') {
// your code
} else if (container.event == 'onClosed') {
// container also returns "finished" variable with boolean value for indicating if video was finished
console.log("Appodeal. Non Skippable Video. " + container.event + ", finished: " + container.finished);
// your code
}
});
To get placement reward data before video is shown use:
Appodeal.getRewardParameters( function(result) {
console.log("Appodeal Reward Amount:" + result.amount);
console.log("Appodeal Reward Currency:" + result.currency);
});
To enable 728*90 banner use the following method:
Appodeal.set728x90Banners(true);
To disable banner refresh animation use:
Appodeal.setBannerAnimation(false);
Appodeal.setSmartBanners(false);
Appodeal.setTesting(true);
In test mode test ads will be shown and debug data will be written to log.
Appodeal.setLogLevel(Appodeal.LogLevel.debug);
Available parameters: Appodeal.LogLevel.none, Appodeal.LogLevel.debug, Appodeal.LogLevel.verbose.
Appodeal.isPrecache(adTypes, function(result){
// result is a boolean value, that equals true if ad is precache
})
Currently supported only for interstitials and banners
To check if loaded interstitial is precache: use Appodeal.isPrecache(Appodeal.INTERSTITIAL);
To check if loaded banner is precache: use Appodeal.isPrecache(Appodeal.BANNER);
Appodeal.cache(adTypes);
setAutoCache(adTypes, false)
.Appodeal.cache(Appodeal.INTERSTITIAL)
Appodeal.cache(Appodeal.REWARDED_VIDEO)
Appodeal.cache(Appodeal.INTERSTITIAL | Appodeal.NON_SKIPPABLE_VIDEO)
Appodeal.cache(Appodeal.BANNER)
Appodeal.setAutoCache(adTypes, false);
Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false)
Appodeal.setAutoCache(Appodeal.REWARDED_VIDEO, false)
Appodeal.setAutoCache(Appodeal.BANNER, false)
Appodeal.setTriggerOnLoadedOnPrecache(adTypes, true);
setOnLoadedTriggerBoth(Appodeal.INTERSTITIAL, false)
- onInterstitialLoaded will trigger only when normal ad was loaded (default)..setOnLoadedTriggerBoth(Appodeal.INTERSTITIAL, true)
- onInterstitialLoaded will trigger twice, both when precache and normal ad were loaded..
Appodeal.setChildDirectedTreatment(true);
Appodeal.disableNetwork(network);
Available parameters: “adcolony”, “admob”, “amazon_ads”, “applovin”, “appnext”, “avocarrot”, “chartboost”, “facebook”, “flurry”, “inmobi”, “inner-active”, “ironsource”, “mailru”, “mmedia”, “mopub”, “ogury”, “openx”, “pubnative”, “smaato”, “startapp”, “tapjoy”, “unity_ads”, “vungle”, “yandex”
Should be used before SDK initialization
To disable toast messages ACCESS_COARSE_LOCATION permission is missing, use the following method:
Appodeal.disableLocationPermissionCheck();
Should be used before SDK initialization.
To disable toast messages WRITE_EXTERNAL_STORAGE permission is missing use the following method:
Appodeal.disableWriteExternalStoragePermissionCheck();
Disables all ad networks that need this permission may lead to low video fillrates.
Should be used before SDK initialization.
Appodeal.trackInAppPurchase(this, 5, "USD");
To show test screen for testing adapters integration call:
Appodeal.showTestScreen();
Appodeal.muteVideosIfCallsMuted(true);
Appodeal.setAge(25);
Appodeal.setGender(UserSettings.Gender.FEMALE);
Possible values: Appodeal.Gender.FEMALE, Appodeal.Gender.MALE, Appodeal.Gender.OTHER.
3.0.5 (21.04.2018)