Interstitial and Rewarded video ads for Android
Networks: Facebook, UnityAds, Google AdMob, IronSource, AdColony, Fyber, Tapjoy, Chartboost, InMoby, MyTarget, Smaato
cordova plugin add https://github.com/valsap/cordova-plugin-applovinmax-ads.git
<config-file parent="./application" target="AndroidManifest.xml">
<meta-data android:name="applovin.sdk.key" android:value=[SDK_KEY_HERE]/>
</config-file>
AppLovinMax.init({
onSuccess : () => {
console.log("Applovin MAX: plugin init success");
},
onFailure : (details) => {
console.log("Applovin MAX: plugin init fail:", details);
}
});
AppLovinMax.setUserId({userId : USER_ID_HERE});
AppLovinMax.initAdUnit({unit : "REWARDED", unitId : UNIT_ID_HERE});
AppLovinMax.initAdUnit({unit : "INTERSTITIAL", unitId : UNIT_ID_HERE});
AppLovinMax.hasRewardedVideo({
onSuccess: function (available) {
console.log("Applovin Max: ready to show rewarded video:", available);
}
});
If you don't use S2S rewarding, just ignore "placement" field
AppLovinMax.showRewardedVideo({
placement : YOUR_PLACEMENT_TO_REWARD_AT_SERVER_SIDE,
onSuccess : () => {},
onFailure : () => {}
});
Rewarded video loading events
window.addEventListener("rewardedVideoLoaded", (data) => {
console.log("Applovin Max: rewarded video loaded:", data["unitId"]);
});
window.addEventListener("rewardedVideoLoadingFailed", (data) => {
console.log("Applovin Max: rewarded video loading error:", data["unitId"], data["errorCode"]);
});
Rewarded video displaying events
window.addEventListener("rewardedVideoDisplayFailed", (data) => {
console.log("Applovin Max: rewarded video display failed:", data["unitId"], data["errorCode"]);
});
window.addEventListener("rewardedVideoDisplayStart", (data) => {
console.log("Applovin Max: rewarded video display start:", data["unitId"]);
});
Rewarded video completed and fired REWARD event
window.addEventListener("rewardedVideoRewardReceived", (data) => {
let unitId = data["unitId"];
let label = data["label"];
let amount = data["amount"];
console.log("Applovin Max: reward received:", unitId, label, amount);
});
Rewarded video watching process events
window.addEventListener("rewardedVideoOpened", (data) => {
console.log("Applovin Max: rewarded video opened:", data["unitId"]);
});
window.addEventListener("rewardedVideoEnded", (data) => {
console.log("Applovin Max: rewarded video ended:", data["unitId"]);
});
window.addEventListener("rewardedVideoHidden", (data) => {
console.log("Applovin Max: rewarded video closed:", data["unitId"]);
});
Rewarded video clicked
window.addEventListener("rewardedVideoClicked", (data) => {
console.log("Applovin Max: rewarded video clicked:", data["unitId"]);
});
AppLovinMax.hasInterstitialVideo({
onSuccess: function (available) {
console.log("Applovin Max: ready to show interstitial video:", available);
}
});
AppLovinMax.showInterstitialVideo({
onSuccess : () => {},
onFailure : () => {}
});
Interstitial video loading events
window.addEventListener("interstitialVideoLoaded", (data) => {
console.log("Applovin Max: interstitial video loaded:", data["unitId"]);
});
window.addEventListener("interstitialVideoLoadingFailed", (data) => {
console.log("Applovin Max: interstitial video loading error:", data["unitId"], data["errorCode"]);
});
Interstitial video displaying events
window.addEventListener("interstitialVideoDisplayFailed", (data) => {
console.log("Applovin Max: interstitial video display failed:", data["unitId"], data["errorCode"]);
});
window.addEventListener("interstitialVideoDisplayStart", (data) => {
console.log("Applovin Max: interstitial video display start:", data["unitId"]);
});
Interstitial video watching process events
window.addEventListener("interstitialVideoHidden", (data) => {
console.log("Applovin Max: interstitial video closed:", data["unitId"]);
});
Interstitial video clicked
window.addEventListener("interstitialVideoClicked", (data) => {
console.log("Applovin Max: interstitial video clicked:", data["unitId"]);
});