Table of Contents

Class AppLovinModule

Namespace
Titipi.MocaLib2

Wraps AppLovin MAX for Banner, Interstitial, and Rewarded ad formats. Each format is backed by a single ad unit that reloads automatically after every show and retries a failed load with exponential backoff (2→64s), per AppLovin's recommended integration. 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

InitializeAsync(AppLovinModuleConfig)

Initializes the AppLovin MAX SDK and wires ad callbacks. Call RequestBannerAd(), RequestInterstitialAd(), and RequestRewardedAd() after this completes to begin loading each format.

Methods

EnableTestAds(List<TestDevice>)

Opts this session into test ads. Call before InitializeAsync(AppLovinModuleConfig) in development builds only. Remove this call before shipping.

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.

IsInterstitialAdReady()

Returns true if the interstitial ad is loaded and ready to display.

IsRewardedAdReady()

Returns true if the rewarded ad is loaded and ready to display.

RequestBannerAd()

Creates and starts loading the banner ad without showing it. Returns immediately; the ad loads asynchronously and raises OnBannerAdLoaded when ready (MAX auto-retries banner loads internally). Call once after InitializeAsync(AppLovinModuleConfig) completes. The banner stays hidden until ShowBannerAd().

RequestInterstitialAd()

Starts loading the interstitial ad. Returns immediately; the ad loads asynchronously and raises OnInterstitialAdLoaded when ready. On load failure it retries automatically with exponential backoff. Call once after InitializeAsync(AppLovinModuleConfig) completes; reloads automatically after each show.

RequestRewardedAd()

Starts loading the rewarded ad. Returns immediately; the ad loads asynchronously and raises OnRewardedAdLoaded when ready. On load failure it retries automatically with exponential backoff. Call once after InitializeAsync(AppLovinModuleConfig) completes; reloads automatically after each show.

ShowBannerAd()

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

ShowInterstitialAdAsync()

Shows the interstitial ad if one is ready. Returns true when the ad was shown and closed normally, or false when not shown because no ad was ready or a display failure occurred.

ShowMediationDebugger()

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

ShowRewardedAdAsync()

Shows the rewarded ad if one is ready. In the Editor, always returns true so game flow can be tested without a real device. Returns true when the user completes the ad and earns the reward, or false otherwise.

Events

OnAdRevenuePaid

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

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.

OnRewardedAdClosed

Fired when a Rewarded ad is dismissed by the user.

OnRewardedAdLoaded

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