LevelPlay Listener with Ad Info Integration

As part of ironSource SDK 7.2.3, you’ll be able to receive more data in ad callbacks, including network, segment, and A/B indication.

Implement the new ad unit listeners

Implement the new LevelPlay listeners, that support AdInfo callback.

The AdInfo represents the last ad that was loaded successfully, and is not included in Load Fail callbacks, as there’s no available ad.

We recommend you to unregister from the old listeners, to avoid data duplications.

Rewarded Video

IronSource.setLevelPlayRewardedVideoListener(new LevelPlayRewardedVideoListener() {
   // Indicates that there's an available ad. 
   // The adInfo object includes information about the ad that was loaded successfully
   // Use this callback instead of onRewardedVideoAvailabilityChanged(true)
   @Override
   public void onAdAvailable(AdInfo adInfo){}

   // Indicates that no ads are available to be displayed 
   // Use this callback instead of onRewardedVideoAvailabilityChanged(false) 
   @Override
   public void onAdUnavailable(){}

   // The Rewarded Video ad view has opened. Your activity will loose focus
   @Override
   public void onAdOpened(AdInfo adInfo){}

   // The Rewarded Video ad view is about to be closed. Your activity will regain its focus
   @Override
   public void onAdClosed(AdInfo adInfo){}

   // The user completed to watch the video, and should be rewarded. 
   // The placement parameter will include the reward data.
   // When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback
   @Override
   public void onAdRewarded(Placement placement, AdInfo adInfo){}

   // The rewarded video ad was failed to show
   @Override
   public void onAdShowFailed(IronSourceError error, AdInfo adInfo){}

   // Invoked when the video ad was clicked. 
   // This callback is not supported by all networks, and we recommend using it 
   // only if it's supported by all networks you included in your build
   @Override
   public void onAdClicked(Placement placement, AdInfo adInfo){}
});

Note: When updating your listener implementation from RewardedVideoListener to LevelPlayRewardedVideoListener, use the callbacks onAdAvailable and onAdUnavailable, instead of using onRewardedVideoAvailabilityChanged.

Rewarded Video Manual Load

IronSource.setLevelPlayRewardedVideoManualListener(new LevelPlayRewardedVideoManualListener() {

   // Indicates that the Rewarded video ad was loaded successfully. 
   // AdInfo parameter includes information about the loaded ad
   @Override
   public void onAdReady(AdInfo adInfo) {}

   // Invoked when the rewarded video failed to load 
   @Override
   public void onAdLoadFailed(IronSourceError error){}

   // The Rewarded Video ad view has opened. Your activity will loose focus
   @Override
   public void onAdOpened(AdInfo adInfo){}

   // The Rewarded Video ad view is about to be closed. Your activity will regain its focus
   @Override
   public void onAdClosed(AdInfo adInfo){}

   // The user completed to watch the video, and should be rewarded. 
   // The placement parameter will include the reward data.
   // When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback
   @Override
   public void onAdRewarded(Placement placement, AdInfo adInfo){}

   // The rewarded video ad was failed to show
   @Override
   public void onAdShowFailed(IronSourceError error, AdInfo adInfo){}

   // Invoked when the video ad was clicked. 
   // This callback is not supported by all networks, and we recommend using it 
   // only if it's supported by all networks you included in your build
   @Override
   public void onAdClicked(Placement placement, AdInfo adInfo){}
   
});

Interstitial

IronSource.setLevelPlayInterstitialListener(new LevelPlayInterstitialListener() {

   // Invoked when the interstitial ad was loaded successfully.
   // AdInfo parameter includes information about the loaded ad   
   @Override
   public void onAdReady(AdInfo adInfo){}

   // Indicates that the ad failed to be loaded 
   @Override
   public void onAdLoadFailed(IronSourceError error){}

   // Invoked when the Interstitial Ad Unit has opened, and user left the application screen.
   // This is the impression indication. 
   @Override
   public void onAdOpened(AdInfo adInfo){}

   // Invoked when the interstitial ad closed and the user went back to the application screen.
   @Override
   public void onAdClosed(AdInfo adInfo){}

   // Invoked when the ad failed to show 
   @Override
   public void onAdShowFailed(IronSourceError error, AdInfo adInfo){}

   // Invoked when end user clicked on the interstitial ad
   @Override
   public void onAdClicked(AdInfo adInfo){}

   // Invoked before the interstitial ad was opened, and before the InterstitialOnAdOpenedEvent is reported.
   // This callback is not supported by all networks, and we recommend using it only if  
   // it's supported by all networks you included in your build. 
   @Override
   public void onAdShowSucceeded(AdInfo adInfo){}
});

banner.setLevelPlayBannerListener(new LevelPlayBannerListener() {

   // Invoked each time a banner was loaded. Either on refresh, or manual load.
   //  AdInfo parameter includes information about the loaded ad   
   @Override
   public void onAdLoaded(AdInfo adInfo){}

   // Invoked when the banner loading process has failed.
   //  This callback will be sent both for manual load and refreshed banner failures. 
   @Override
   public void onAdLoadFailed(IronSourceError error){}

   // Invoked when end user clicks on the banner ad
   @Override
   public void onAdClicked(AdInfo adInfo){}

   // Notifies the presentation of a full screen content following user click
   @Override
   public void onAdScreenPresented(AdInfo adInfo){}

   // Notifies the presented screen has been dismissed
   @Override
   public void onAdScreenDismissed(AdInfo adInfo){}

   //Invoked when the user left the app
   @Override
   public void onAdLeftApplication(AdInfo adInfo){}
   
});

Note: The callbacks onAdLoaded and onAdLoadFailed will be sent both for manual load and refreshed banners.

Integrate the AdInfo data

Once you implement the LevelPlay Listeners with AdInfo, you’ll be able to use the data as part of your app’s data.

If the AdInfo data is not available, the adInfo string params will return an empty string, and the numeric params will return 0 value.

IronSource.setLevelPlayListener(LevelPlayInterstitialListener) {
   @override
   public void onAdReady (AdInfo adInfo)
   {
      String AdUnit = adInfo.getAdUnit();
      String AuctionId = adInfo.getAuctionId();
      String AdNetwork = adInfo.getAdNetwork();
      String Ab = adInfo.getAb();
      String Country = adInfo.getCountry();
      String InstanceId = adInfo.getInstanceId();
      String InstanceName = adInfo.getInstanceName();
      String SegmentName = adInfo.getSegmentName();
      Double Revenue = adInfo.getRevenue();
      String Precision = adInfo.getPrecision();
      String EncryptedCPM = adInfo.getEncryptedCPM();
   }
}

Ad Info fields

Here’s a list of the relevant data fields, including description and type that are being returned as part of the new AdInfo object:

Parameter Name Description Data Type
auctionId Unique identifier for the auction String
adUnit The ad unit displayed (Rewarded Video/Interstitial/Banner) String
adNetwork The ad network name that served the ad String
instanceName The ad network instance name as defined on the platform. For bidding sources, the instance name will be ‘Bidding’ String
instanceId Identifier per network, this includes the ad network’s
instanceID/placement/zone/etc.
String
country Country code ISO 3166-1 format String
revenue The revenue generated for the impression (USD). The revenue value is either estimated or exact, according to the precision (see precision field description) Double
precision The source value of the revenue field:
BID – The revenue provided as part of the real-time auction (Not supported by FAN bidders)
RATE – manual price the publisher assigned to an instance in the ironSource platform
CPM – Calculation based on historical instance performance, performed by ironSource platform
String
ab Indication if A/B test was activated via ironSource platform String
segmentName The segment the user is related to as defined based on the segmentation method String
encryptedCPM Relevant for ads provided by Meta Audience Network only, and will be reported to publishers approved by Meta Audience Network within the closed beta String