Table of Contents

Class AppLovinModule

Namespace
Titipi.MocaLib

Wraps AppLovin MAX for App Open, Banner, Interstitial, and Rewarded ad formats. Manages multiple ad units per format, sorted by eCPM, with automatic reload on failure. Not supported on WebGL.

public static class AppLovinModule
Inheritance
AppLovinModule
Inherited Members

Properties

Config

The config used to initialize this module.

IsInitialized

Whether the AppLovin SDK has been initialized successfully.

Initialization

Initialize(AppLovinModuleConfig)

Initializes the AppLovin MAX SDK, wires ad callbacks, and begins preloading ads.

Methods

AllowAppOpenAd(bool)

Enables or suppresses App Open ads. When re-enabling (allow = true), applies a 2-second grace period to avoid showing immediately after another ad closes. Call with false before showing interstitial/rewarded ads to prevent overlap.

GetBannerHeight(Canvas)

Returns the banner height in pixels (or in canvas units when canvas is provided). Returns a fixed editor-only value of 168px in the Editor.

HideBannerAd()

Hides the banner ad without destroying it. Subsequent calls to ShowBannerAd() will restore it instantly.

IsAppOpenAdReady()

Returns true if an App Open ad is loaded and ready to display.

IsInterstitialAdReady()

Returns true if at least one interstitial unit is loaded and ready to display.

IsRewardedAdReady()

Returns true if at least one rewarded unit is loaded and ready to display.

RegisterOnRewardedAdAvailabilityChanged(Action<bool>)

Subscribes callback to OnRewardedAdAvailabilityChanged events.

ShowAppOpenAd()

Attempts to show an App Open ad. Respects a 10-second cooldown after the previous one closed, and silently no-ops when suppressed via AllowAppOpenAd(bool). Triggers a load if the ad is not yet ready.

ShowBannerAd()

Shows the banner ad at the bottom-center position. Remembers visibility so the banner is restored after app resume.

ShowInterstitialAd(Action<bool, int>)

Shows the highest-eCPM ready interstitial unit. Respects the InterstitialInterval cooldown between consecutive shows. The callback receives (true, durationSeconds) on close, or (false, 0) when not shown due to cooldown, no ready unit, or a display failure.

ShowMediationDebugger()

Opens the AppLovin MAX mediation debugger to inspect adapter status and test ads.

ShowRewardedAd(Action<bool, int>)

Shows the highest-eCPM ready rewarded unit. In the Editor, always invokes the callback with (true, 0) so game flow can be tested without a real device. The callback receives (true, durationSeconds) when the user completes the ad, or (false, 0) otherwise.

Events

OnAdRevenuePaid

Fired for every ad impression revenue event. Wire this to AppsFlyerModule.LogAdRevenue or FirebaseModule.LogAdRevenue.

OnAppOpenAdClosed

Fired when an App Open ad is dismissed by the user.

OnAppOpenAdDisplayed

Fired when an App Open ad is displayed on screen.

OnAppOpenAdLoaded

Fired when an App Open ad has finished loading and is ready to show.

OnBannerAdLoaded

Fired when a Banner ad has loaded.

OnInterstitialAdClosed

Fired when an Interstitial ad is dismissed by the user.

OnInterstitialAdLoaded

Fired when an Interstitial ad has loaded and is ready to show.

OnRewardedAdAvailabilityChanged

Fired when rewarded ad availability changes (true = at least one unit is ready).

OnRewardedAdClosed

Fired when a Rewarded ad is dismissed by the user.

OnRewardedAdLoaded

Fired when a Rewarded ad has loaded and is ready to show.