Android SDK 6.5.x API Changes

This document has been prepared for publishers updating their existing v6 Vungle SDK integration since Android SDK 6.5.1 has API changes. Publisher updating from Vungle SDK 6.3.24 or 6.4.11 must make following API changes, but only the first item should affect most integration, second item affecting some publishers and last item should affect very few integration.

1. onError callback from InitCallback, LoadAdCallback and PlayAdCallback now passes VungleException that contains error message and code instead of Throwable.

New onError Callback API for v6.5.x
InitCallback LoadAdCallback PlayAdCallback
Vungle.init("VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {
  ...
  @Override
  public void onError(VungleException exception) { }
  ...
});
Deprecated onError Callback for legacy v6
InitCallback LoadAdCallback PlayAdCallback
Vungle.init("VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {
  ...
  @Override
  public void onError(Throwable throwable) { }
  ...
});

 

2. This is only applicable if you were previously using setAutoRotate feature by passing an AdConfig object during playAd. Previous SDK had setAutoRotate method that controls whether video ad can be rotated depending the ad orientation or this feature disabled. v6.5.0 has changed this feature to setAdOrientation method that configure ad to play in portrait and landscape only or set to auto-rotate.

New setAdOrientation for v6.5.x
AdConfig adConfig = new AdConfig();
adConfig.setAdOrientation(AdConfig.AUTO_ROTATE) // AdConfig.PORTRAIT, AdConfig.LANDSCAPE
Vungle.playAd("PLACEMENT_ID", adConfig, vunglePlayAdCallback);
Deprecated setAutoRotate for legacy v6
AdConfig adConfig = new AdConfig();
adConfig.setAutoRotate(false); // true by default
Vungle.playAd("PLACEMENT_ID", adConfig, vunglePlayAdCallback);

 

3. This is only applicable for In-feed type ad which is not commonly used. The getNativeAd API for In-feed type ad now takes an additional AdConfig object.

New In-feed type getNativeAd API for v6.5.x
Vungle.getNativeAd("INFEED_ID", new AdConfig(), vunglePlayAdCallback);
Deprecated In-feed type getNativeAd API for legacy v6
Vungle.getNativeAd("INFEED_ID", vunglePlayAdCallback);

Questions?

Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?