Page tree

Try out our new and improved Documentation Center!
Learn More

Skip to end of metadata
Go to start of metadata

Lazy Load for Android

On This Page


The Lazy Load feature provides a new API call to manage when all trackers are fired, including third-party trackers and MobileSDK trackers.  It also optimizes the Banner AdUnit by allowing the host app to load its webview only when it is needed and just before it is needed.  When this feature is enabled, the traditional loadAd method is followed later by a second method, loadLazyAd.

Firing Trackers

The Lazy Load feature is developed to fire all Mobile SDK and third-party trackers at the same instance, ensuring an alignment between both the metrics can be maintained

The high-level lifecycle of an AdUnit consists of two stages as load and display.  This feature divides the load stage into two further steps as loadAd and loadLazyAd, followed by display stageHaving said that, a banner webview can be attached to the display, even before loadAd is called.  However the display stage is a convenience provided by the platform and is separate from the load portion of the AdUnit lifecycle.

The second step loadLazyAd in load stage accomplishes two tasks :

  • Completes the load of the AdUnit by creating and loading the webview which fires the third-party trackers in the creative.
  • Fires the MobileSDK trackers.

Managing CPU Consumption 

The Lazy Load feature causes the initial loadAd to return a lightweight AdUnit and allows the contents to be loaded later. This functionality reduces the load time for the AdUnit by deferring the creation and configuration of the internal webview to a later point. By delaying the webview load, it reduces the consumption of additional CPU time of loading the ad object returned in the Universal Tag in the cases where the AdUnit is unused.

Additionally, it allows the host app to choose the optimal moment to fire trackers and consume CPU time to load the webview, ideally at the best possible moment before the ad is displayed to the end-user (or is queued for display with a high probability).

Scope of Lazy Load

The scope of this feature is limited to Banner AdUnits that display banner Media Types.  It does not apply to any other AdUnit, including instream video and native, nor does it apply to Media Types returned by a multi-format Banner AdUnit other than banner including banner-video (outstream video) and banner-native. 


Lazy Load enhances the MobileSDK public API with a property (a getter method) which indicates whether the feature is enabled or not. 





boolean--Indicates if Lazy Load feature is enabled
public boolean isLazyLoadEnabled;  // getter



Setter method which enables the Lazy Load feature.

public void enableLazyLoad();  // setter


Loads the webview of a lazy loaded AdUnit and fires all trackers, including third-party and MobileSDK trackers.

public void loadLazyAd()

Listener Callbacks


onLazyAdLoaded is fired when the loadAd method successfully returns a lazy loaded AdUnit, that is an AdUnit with an unallocated webview.  All other features of the AdUnit instance are available, including a populated instance of ANAdResponseInfoIf loadAd fails, then the same callbacks are used as for an AdUnit that was not lazy loaded.

public void onLazyAdLoaded(AdView adView)


override fun onCreate(savedInstanceState: Bundle?)
        banner = BannerAdView(this)
        banner.placementID = “1234567”
        banner.setAdSize(300, 250)
// AdListener Callback method
override fun onLazyAdLoaded(adView: AdView) {
        // Ad is loaded Lazily, Further processing goes here.
// Call this method as per the need, to load the webview content.
// AdListener Callback method
override fun onAdLoaded(adView: AdView) {
    // Ad loaded, after loadLazyAd() was invoked.
  • No labels