public class

AppLovinAdView

extends RelativeLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.RelativeLayout
         ↳ com.applovin.adview.AppLovinAdView

Class Overview

This class provides a subclass of android.view.View which is used to render AppLovin advertisements.

Summary

Constants
String NAMESPACE This is a namespace that should be used for custom properties of AppLovinAdView.
[Expand]
Inherited Constants
From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
AppLovinAdView(AppLovinAdSize adSize, Context context)
Create a new AppLovin ad view for a given size.
AppLovinAdView(AppLovinAdSize adSize, String zoneId, Context context)
Create a new AppLovin ad view for a given size and zone.
AppLovinAdView(AppLovinSdk sdk, AppLovinAdSize adSize, Context context)
Create a new AppLovin ad view for a given sdk and size.
AppLovinAdView(AppLovinSdk sdk, AppLovinAdSize adSize, String zoneId, Context context)
Create a new AppLovin ad view for a given sdk, size, and zone.
Public Methods
void destroy()
Destroy current ad.
AdViewController getAdViewController()
This method is deprecated. - This is for internal use only and will be removed in a later SDK version.
AppLovinAdSize getSize()
Get current ad view size.
String getZoneId()
The zone identifier this AppLovinAdView was initialized with and is loading ads for, if any.
boolean isAdReadyToDisplay()
This method is deprecated. Checking whether an ad is ready for display has been deprecated and will be removed in a future SDK version. Please use one of the loadNextAd(...) methods in AppLovinAdService or renderAd(AppLovinAd) to display an ad.
void loadNextAd()
Loads AND displays an ad into the view.
void pause()
Pause all animations and clear current ad
void renderAd(AppLovinAd ad)
Render specified ad.
void renderAd(AppLovinAd ad, String placement)
This method is deprecated. Placements have been deprecated and will be removed in a future SDK version. Please configure zones from the UI and use them instead.
void resume()
Resume all animations and the current ad
void setAdClickListener(AppLovinAdClickListener callback)
Set a callback that would be notified of ad click events.
void setAdDisplayListener(AppLovinAdDisplayListener callback)
Set a callback that would be notified of ad display events.
void setAdLoadListener(AppLovinAdLoadListener callback)
Set a callback that would be notified of ad loading events.
void setAdVideoPlaybackListener(AppLovinAdVideoPlaybackListener callback)
Set a callback that may be notified of ad video playback events, if and only if the ad contains a video.
void setAdViewEventListener(AppLovinAdViewEventListener callback)
Set a callback that would be notified of events specific to this ad view.
void setAutoDestroy(boolean isAutoDestroy)
Change the way ad view handles onDetachedFromWindow() callback.
[Expand]
Inherited Methods
From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Constants

public static final String NAMESPACE

This is a namespace that should be used for custom properties of AppLovinAdView.

Constant Value: "http://schemas.applovin.com/android/1.0"

Public Constructors

public AppLovinAdView (AppLovinAdSize adSize, Context context)

Create a new AppLovin ad view for a given size. Default parameters will be used.

Parameters
adSize Size of the ad to display. Must not be null.
context Parent activity or application context. Must not be null.

public AppLovinAdView (AppLovinAdSize adSize, String zoneId, Context context)

Create a new AppLovin ad view for a given size and zone.

Parameters
adSize Size of the ad to display. Must not be null.
zoneId Id of the zone this ALAdView should load ads for.
context Parent activity or application context. Must not be null.

public AppLovinAdView (AppLovinSdk sdk, AppLovinAdSize adSize, Context context)

Create a new AppLovin ad view for a given sdk and size.

Parameters
sdk AppLovin SDK to use. Must not be null. An instance of the SDK may be obtained by calling AppLovinSdk.getInstance(). See AppLovinSdk for more details.
adSize Size of the ad to display. Must not be null.
context Parent activity or application context. Must not be null.

public AppLovinAdView (AppLovinSdk sdk, AppLovinAdSize adSize, String zoneId, Context context)

Create a new AppLovin ad view for a given sdk, size, and zone.

Parameters
sdk AppLovin SDK to use. Must not be null. An instance of the SDK may be obtained by calling AppLovinSdk.getInstance(). See AppLovinSdk for more details.
adSize Size of the ad to display. Must not be null.
zoneId Id of the zone this ALAdView should load ads for.
context Parent activity or application context. Must not be null.

Public Methods

public void destroy ()

Destroy current ad.

Please note: Ads can not be loaded after the view is destroyed.

public AdViewController getAdViewController ()

This method is deprecated.
- This is for internal use only and will be removed in a later SDK version.

For internal use only.

public AppLovinAdSize getSize ()

Get current ad view size.

Returns
  • Current size or null if none defined

public String getZoneId ()

The zone identifier this AppLovinAdView was initialized with and is loading ads for, if any.

public boolean isAdReadyToDisplay ()

This method is deprecated.
Checking whether an ad is ready for display has been deprecated and will be removed in a future SDK version. Please use one of the loadNextAd(...) methods in AppLovinAdService or renderAd(AppLovinAd) to display an ad.

public void loadNextAd ()

Loads AND displays an ad into the view. This method returns immediately.

Please note: To load ad but not display it, use AppLovinSdk.getInstance(context).getAdService().loadNextAd(...) then adView.renderAd(...) to render it.

public void pause ()

Pause all animations and clear current ad

public void renderAd (AppLovinAd ad)

Render specified ad.

Parameters
ad Ad to render. Must not be null.

public void renderAd (AppLovinAd ad, String placement)

This method is deprecated.
Placements have been deprecated and will be removed in a future SDK version. Please configure zones from the UI and use them instead.

public void resume ()

Resume all animations and the current ad

public void setAdClickListener (AppLovinAdClickListener callback)

Set a callback that would be notified of ad click events.

Parameters
callback A callback to be notified of ad click events.

public void setAdDisplayListener (AppLovinAdDisplayListener callback)

Set a callback that would be notified of ad display events. These include add displayed and ad hidden.

Parameters
callback A callback to be notified of ad loading events.

public void setAdLoadListener (AppLovinAdLoadListener callback)

Set a callback that would be notified of ad loading events. These include add loaded and ad failed to load events

Parameters
callback A callback to be notified of ad loading events.

public void setAdVideoPlaybackListener (AppLovinAdVideoPlaybackListener callback)

Set a callback that may be notified of ad video playback events, if and only if the ad contains a video.

Parameters
callback A callback to be notified of ad loading events.

public void setAdViewEventListener (AppLovinAdViewEventListener callback)

Set a callback that would be notified of events specific to this ad view.

Parameters
callback A callback to be notified of events specific to this ad view.

public void setAutoDestroy (boolean isAutoDestroy)

Change the way ad view handles onDetachedFromWindow() callback. By default isAutoDestroy is true and the web view would be destroyed automatically.

Parameters
isAutoDestroy True of the view should be destoyed automatically when detached from the window.