Class AppLovinModule
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. Supported on Android, iOS, and the Unity Editor; on any other platform every method logs its entry and no-ops, returning its default value (the MAX SDK only exists on those platforms, so every body that touches it is gated on the same allowlist).
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. Honors the Remote Config kill-switch: when Enabled is
false, returnsfalsewithout starting the SDK — callers never need to check it.
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
canvasis 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
trueif the interstitial ad is loaded and ready to display.
- IsRewardedAdReady()
Returns
trueif 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
truewhen the ad was shown and closed normally, orfalsewhen 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
trueso game flow can be tested without a real device. Returnstruewhen the user completes the ad and earns the reward, orfalseotherwise.
Events
- OnAdRevenuePaid
Fired for every ad impression revenue event. Wire this to
AppsFlyerModule.LogAdRevenueorFirebaseModule.LogAdRevenue.
- OnBannerAdClicked
Fired when the user clicks a Banner ad.
- OnBannerAdLoadFailed
Fired when a Banner ad fails to load. MAX retries banner loads internally.
- OnBannerAdLoaded
Fired when a Banner ad has loaded.
- OnInterstitialAdClicked
Fired when the user clicks an Interstitial ad.
- OnInterstitialAdClosed
Fired when an Interstitial ad is dismissed by the user.
- OnInterstitialAdDisplayed
Fired when an Interstitial ad appears on screen. Use this to mute audio and pause gameplay.
- OnInterstitialAdLoadFailed
Fired when an Interstitial ad fails to load. A capped exponential-backoff retry is already scheduled, so this may fire repeatedly while the ad remains unavailable — it is transient, not terminal.
- OnInterstitialAdLoaded
Fired when an Interstitial ad has loaded and is ready to show.
- OnRewardedAdClicked
Fired when the user clicks a Rewarded ad.
- OnRewardedAdClosed
Fired when a Rewarded ad is dismissed by the user. This says the ad went away — not that the reward was earned. Await ShowRewardedAdAsync() for that.
- OnRewardedAdDisplayed
Fired when a Rewarded ad appears on screen. Use this to mute audio and pause gameplay.
- OnRewardedAdLoadFailed
Fired when a Rewarded ad fails to load. A capped exponential-backoff retry is already scheduled, so this may fire repeatedly while the ad remains unavailable — it is transient, not terminal.
- OnRewardedAdLoaded
Fired when a Rewarded ad has loaded and is ready to show.