Skip to content

squaretwo/cordova-plugin-applovinmax-ads

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppLovin Max mediation plugin

Interstitial and Rewarded video ads for Android

Networks: Facebook, UnityAds, Google AdMob, IronSource, AdColony, Fyber, Tapjoy, Chartboost, InMoby, MyTarget, Smaato

Install

cordova plugin add https://github.com/valsap/cordova-plugin-applovinmax-ads.git

Add SDK_KEY to your config.xml file

<config-file parent="./application" target="AndroidManifest.xml">
  <meta-data android:name="applovin.sdk.key" android:value=[SDK_KEY_HERE]/>
</config-file>

Usage

To initialize plugin

AppLovinMax.init({
  onSuccess : () => {
    console.log("Applovin MAX: plugin init success");
  },
  onFailure : (details) => {
    console.log("Applovin MAX: plugin init fail:", details);
  }
});

Set custom user id

AppLovinMax.setUserId({userId : USER_ID_HERE});

Init AD UNITs.

AppLovinMax.initAdUnit({unit : "REWARDED", unitId : UNIT_ID_HERE});
AppLovinMax.initAdUnit({unit : "INTERSTITIAL", unitId : UNIT_ID_HERE});

Rewarded video ads

Has next rewarded video loaded and ready to show

AppLovinMax.hasRewardedVideo({
  onSuccess: function (available) {
    console.log("Applovin Max: ready to show rewarded video:", available);
  }
});

Show rewarded video

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 events

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"]);
});

Interstitial video

Has next interstitial video loaded and ready to show

AppLovinMax.hasInterstitialVideo({
  onSuccess: function (available) {
    console.log("Applovin Max: ready to show interstitial video:", available);
  }
});

Show interstitial video

AppLovinMax.showInterstitialVideo({
    onSuccess : () => {},
    onFailure : () => {}
});

Interstitial video events

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"]);
});

About

AppLovin Max mediation plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 76.8%
  • JavaScript 23.2%