public interface

AppLovinAdService

com.applovin.sdk.AppLovinAdService

Class Overview

This class is responsible for loading and displaying advertisements.

An instance of this class can be obtained from an AppLovinSdk instance via getAdService().

Summary

Constants
String URI_AD_SERVICE This is an object name for custom AppLovin URL.
String URI_API_SERVICE This is an object name for custom AppLovin URL.
String URI_CLOSE_AD This is an endpoint name for custom AppLovin URL for forcing ad container to close itself:

        applovin://com.applovin.sdk/adservice/close_ad
 
String URI_CONTRACT_AD This is an endpoint name for custom AppLovin URL for forcing an ad expanded before using URI_EXPAND_AD contract back

        applovin://com.applovin.sdk/adservice/contract_ad
 
String URI_EXPAND_AD This is an endpoint name for custom AppLovin URL for forcing ad container to expand itself (using MRAID mechanism):

        applovin://com.applovin.sdk/adservice/expand_ad
 
String URI_LAUNCH_APP This is an object name for custom AppLovin URL.
String URI_NEXT_AD This is an endpoint name for custom AppLovin URL for forcing container to load the next ad:

        applovin://com.applovin.sdk/adservice/next_ad
 
Public Methods
abstract void addAdUpdateListener(AppLovinAdUpdateListener adListener)
This method is deprecated. Use addAdUpdateListener(AppLovinAdUpdateListener adListener, AppLovinAdSize adSize) instead.
abstract void addAdUpdateListener(AppLovinAdUpdateListener adListener, AppLovinAdSize adSize)
Ad a listener that will be updated every time a new ad is loaded.
abstract boolean hasPreloadedAd(AppLovinAdSize adSize)
Check whether an ad of a given size is currently preloaded and available for display.
abstract void loadNextAd(AppLovinAdSize adSize, AppLovinAdLoadListener callback)
Fetch a new ad, of a given size, notifying a supplied listener on completion.
abstract void loadNextMediatedAd(AppLovinAdSize adSize, AppLovinAdLoadListener callback)
Fetch a new ad, of a given size, notifying a supplied listener on completion.
abstract void preloadAd(AppLovinAdSize adSize)
Pre-load an ad manually, if there is not already an ad of the given size cached.
abstract void removeAdUpdateListener(AppLovinAdUpdateListener adListener, AppLovinAdSize adSize)
Remove a listener that was notified every time an ad was loaded.

Constants

public static final String URI_AD_SERVICE

This is an object name for custom AppLovin URL. For example:

        applovin://com.applovin.sdk/adservice/*
 

Constant Value: "/adservice"

public static final String URI_API_SERVICE

This is an object name for custom AppLovin URL. For example:

        applovin://com.applovin.sdk/api/*
 

Constant Value: "/api"

public static final String URI_CLOSE_AD

This is an endpoint name for custom AppLovin URL for forcing ad container to close itself:

        applovin://com.applovin.sdk/adservice/close_ad
 

Constant Value: "/adservice/close_ad"

public static final String URI_CONTRACT_AD

This is an endpoint name for custom AppLovin URL for forcing an ad expanded before using URI_EXPAND_AD contract back

        applovin://com.applovin.sdk/adservice/contract_ad
 

Constant Value: "/adservice/contract_ad"

public static final String URI_EXPAND_AD

This is an endpoint name for custom AppLovin URL for forcing ad container to expand itself (using MRAID mechanism):

        applovin://com.applovin.sdk/adservice/expand_ad
 

Constant Value: "/adservice/expand_ad"

public static final String URI_LAUNCH_APP

This is an object name for custom AppLovin URL. For example:

        applovin://com.applovin.sdk/launch/*
 

Constant Value: "/launch"

public static final String URI_NEXT_AD

This is an endpoint name for custom AppLovin URL for forcing container to load the next ad:

        applovin://com.applovin.sdk/adservice/next_ad
 

Constant Value: "/adservice/next_ad"

Public Methods

public abstract void addAdUpdateListener (AppLovinAdUpdateListener adListener)

This method is deprecated.
Use addAdUpdateListener(AppLovinAdUpdateListener adListener, AppLovinAdSize adSize) instead.

Overloaded method for addAdUpdateListener(AppLovinAdUpdateListener, AppLovinAdSize), where ad size is defaulted to BANNER.

Parameters
adListener A listener for the new ads. Must not be null.

public abstract void addAdUpdateListener (AppLovinAdUpdateListener adListener, AppLovinAdSize adSize)

Ad a listener that will be updated every time a new ad is loaded. Each listener only listens to ads that are of the given size.

Parameters
adListener A listener for the new ads. Must not be null.
adSize The size of the ad.

public abstract boolean hasPreloadedAd (AppLovinAdSize adSize)

Check whether an ad of a given size is currently preloaded and available for display.

Parameters
adSize Size of the ad to check pre-load state for.
Returns
  • True if an ad of this size is pre-loaded and ready to display without further network activity. False if requesting an ad of this size would require fetching over the network.

public abstract void loadNextAd (AppLovinAdSize adSize, AppLovinAdLoadListener callback)

Fetch a new ad, of a given size, notifying a supplied listener on completion.

Parameters
adSize Size of an ad to load. Must not be null.
callback A callback to notify of the fact that the ad is loaded. Must not be null. A reference to the callback will be persisted until the ad is loaded.

public abstract void loadNextMediatedAd (AppLovinAdSize adSize, AppLovinAdLoadListener callback)

Fetch a new ad, of a given size, notifying a supplied listener on completion. This ad will be served using AppLovin Mediation layer, so it may actually be rendered by a thrid-party SDK

Parameters
adSize Size of an ad to load. Must not be null.
callback A callback to notify of the fact that the ad is loaded. Must not be null. A reference to the callback will be persisted until the ad is loaded.

public abstract void preloadAd (AppLovinAdSize adSize)

Pre-load an ad manually, if there is not already an ad of the given size cached.

Parameters
adSize Size of the ad to pre-load.

public abstract void removeAdUpdateListener (AppLovinAdUpdateListener adListener, AppLovinAdSize adSize)

Remove a listener that was notified every time an ad was loaded. The listener must have been added through addAdUpdateListener().

Parameters
adListener Listener to remove.
adSize The size of the ad for which this listener should stop receiving notifications.