Skip to content

Delayed Visible and Viewable Event support

Choose a tag to compare

@jason-adnuntius jason-adnuntius released this 28 Jul 22:39
· 7 commits to master since this release

Until this release, the SDK would generate visible and viewable events as soon as the ad was rendered. There was no way to change this, with this release we have added the capability to delay generating these events.

IMPORTANT: By default beginning with SDK 1.7.0 calling loadAd(request, handler) will result in no visible or viewable events being triggered at all. This is different to the previous default behaviour. You can restore the original behaviour by using a new loadAd variant with delayViewEvents=false.

To make viewable / visible events work correctly, each AdnuntiusAdWebView must know whether its visible and how much of the ad is showing before it can generate visible and viewable events. This is facilitated by your client code calling the new updateView(ScrollView) method.

Initially only support for applications which make use of ScrollView is provided. if you have a case which is not catered for by this new updateView method, you can raise a support issue or raise a PR to add it!

More information on this feature: https://github.com/Adnuntius/android_sdk/wiki/Visible-and-Viewable-Event-Handling

Deprecations

The following AdnuntiusAdWebView method has been deprecated:

  • public void loadAd(final AdRequest request, final CompletionHandler handler)

You should migrate your code to use the new loadAd(final AdRequest request, final LoadAdHandler handler) method

The LoadAdHandler interface is a replacement for the deprecated CompletionHandler . All methods in the LoadAdHandler except for onAdResponse are optional.

Migrating from CompletionHandler to LoadAdHandler

The onComplete(init adCount) has been migrated to two different method calls:

  1. Where adCount == 0, the onNoAdResponse(AdnuntiusAdWebView view) method is called.
  2. Where adCount == 1, the onAdResponse(AdnuntiusAdWebView view, AdResponseInfo info) is called.

In previous versions of the SDK the adCount was only ever 0 or 1, so adCount is no longer returned at all.

The onFailure(String message) method has been replaced with onFailure(AdnuntiusAdWebView view, String message)

The onClose() has been replaced with onLayoutCloseView(AdnuntiusAdWebView view)

Removals

The following long deprecated AdnuntiusAdWebView methods have been removed:

  • public void loadFromApi(final String requestJson, final CompletionHandler handler)
  • public void loadFromConfig(final AdConfig config, final CompletionHandler handler)

The loadFromConfig can be migrated to loadAd as for the migration of loadAd with the deprecated CompletionHandler. However there is no easy migration path for loadFromApi, this method was long ago deprecated.