Guide for migrating to version 5

Warning.

This is an archived version of the documentation. Actual documentation for all platforms can be found here.

  1. Additions
  2. Changes
  3. Removals
  4. Recommendations

Additions

Package com.yandex.mobile.ads.banner
BannerAdEventListener interface
  • Added the void onImpression(ImpressionData impressionData) method that is called when an impression is counted.
  • Added the void onAdClicked() method that is called once the user clicks on the banner.
Package com.yandex.mobile.ads.instream.exoplayer

Added a new package for integrating InStream ads using ExoPlayer.

Package com.yandex.mobile.ads.instream.player.ad
InstreamAdPlayerListener interface
  • Added a new method named void onAdBufferingFinished(VideoAd videoAd). Called when the InstreamAdPlayer finishes buffering a video ad.
  • Added a new method named void onAdBufferingStarted(VideoAd videoAd). Called when the InstreamAdPlayer starts buffering a video ad.
Package com.yandex.mobile.ads.instream.player.ar.error

Added a new package to handle InstreamAdPlayer errors.

Package com.yandex.mobile.ads.interstitial
InterstitialAdEventListener interface
  • Added the void onImpression(ImpressionData impressionData) method that is called when an impression is counted.
  • Added the void onAdClicked() method that is called once the user clicks on an ad.
Package com.yandex.mobile.ads.nativeads
NativeAdEventListener interface
  • Added the void onImpression(ImpressionData impressionData) method that is called when an impression is counted.
  • Added the void onAdClicked() method that is called once the user clicks on an ad.
Package com.yandex.mobile.ads.rewarded
RewardedAdEventListener interface
  • Added the void onImpression(ImpressionData impressionData) method that is called when an impression is counted.
  • Added the void onAdClicked() method that is called once the user clicks on an ad.

Changes

Package com.yandex.mobile.ads.banner
BannerAdView class
  • The void setBlockId method was renamed to void setAdUnitId.
Package com.yandex.mobile.ads.interstitial
InterstitialAd class
  • The void setBlockId method was renamed to void setAdUnitId.
Package com.yandex.mobile.ads.nativeads
NativeAdRequestConfiguration.Builder class
  • The public Builder(@NonNull java.lang.String blockId) method was renamed to public Builder(@NonNull java.lang.String adUnitId).
Package com.yandex.mobile.ads.rewarded
RewardedAd class
  • The void setBlockId method was renamed to void setAdUnitId.

Removals

Package com.yandex.mobile.ads.banner
AdSize class

Removed the following methods:

  • static AdSize flexibleSize()
  • static AdSize flexibleSize(int width)
Package com.yandex.mobile.ads.instream
  • Removed the InstreamAdSkipInfo interface.
Package com.yandex.mobile.ads.instream.model

The package was removed.

Package com.yandex.mobile.ads.nativeads
  • Removed the SliderAdView class.

Recommendations

Version 4.X.Y Version 5

final AdSize flexibleAdSize = AdSize.flexibleSize(width);

Removed, alternative:
final AdSize flexibleAdSize = AdSize.flexibleSize(width, height);

final AdSize flexibleAdSize = AdSize.flexibleSize();

Removed, alternative:
final AdSize flexibleAdSize = AdSize.flexibleSize(width, height);

mBannerAdView.setBlockId(<BlockId>);

The BlockId parameter was renamed AdUnitId.
mBannerAdView.setAdUnitId(<AdUnitId>);

mInterstitialAd.setBlockId(<BlockId>);

The BlockId parameter was renamed AdUnitId.
mInterstitialAd.setAdUnitId(<AdUnitId>);

mRewardedAd.setBlockId(<AdUnitID>);

The BlockId parameter was renamed AdUnitId.
mRewardedAd.setAdUnitId(<AdUnitId>);
final NativeAdRequestConfiguration nativeAdRequestConfiguration = 
    new NativeAdRequestConfiguration.Builder(BlockId).build();
The BlockId parameter was renamed to AdUnitId:
final NativeAdRequestConfiguration nativeAdRequestConfiguration = 
    new NativeAdRequestConfiguration.Builder(AdUnitId).build();                            

bindSliderAd(@NonNull final SliderAdView sliderAdView);

Changed the View setting method:
bindSliderAd(@NonNull final SliderAdViewBinder viewBinder);

void onError(@NonNull final VideoAd videoAd);

void onError(@NonNull final VideoAd videoAd, @NonNull final InstreamAdPlayerError error);

Version 4.X.Y Version 5

final AdSize flexibleAdSize = AdSize.flexibleSize(width);

Removed, alternative:
final AdSize flexibleAdSize = AdSize.flexibleSize(width, height);

final AdSize flexibleAdSize = AdSize.flexibleSize();

Removed, alternative:
final AdSize flexibleAdSize = AdSize.flexibleSize(width, height);

mBannerAdView.setBlockId(<BlockId>);

The BlockId parameter was renamed AdUnitId.
mBannerAdView.setAdUnitId(<AdUnitId>);

mInterstitialAd.setBlockId(<BlockId>);

The BlockId parameter was renamed AdUnitId.
mInterstitialAd.setAdUnitId(<AdUnitId>);

mRewardedAd.setBlockId(<AdUnitID>);

The BlockId parameter was renamed AdUnitId.
mRewardedAd.setAdUnitId(<AdUnitId>);
final NativeAdRequestConfiguration nativeAdRequestConfiguration = 
    new NativeAdRequestConfiguration.Builder(BlockId).build();
The BlockId parameter was renamed to AdUnitId:
final NativeAdRequestConfiguration nativeAdRequestConfiguration = 
    new NativeAdRequestConfiguration.Builder(AdUnitId).build();                            

bindSliderAd(@NonNull final SliderAdView sliderAdView);

Changed the View setting method:
bindSliderAd(@NonNull final SliderAdViewBinder viewBinder);

void onError(@NonNull final VideoAd videoAd);

void onError(@NonNull final VideoAd videoAd, @NonNull final InstreamAdPlayerError error);