Search code examples
androidmopub

Android - Getting reference to the WebView instance MoPubView uses to show the ad


I'm trying to add my own functionality to various ad networks, and now trying to inject some code into the WebView that presents MoPub's ads.

When looking at the MoPubView object, I see it's a FrameLayout, without any WebView, but it's clearly presenting HTML when I load ads.

How can I get my hold on the WebView?


Solution

  • Turns out that MoPubView adds another view when the ad loads - com.mopub.mobileads.HtmlBannerWebView.

    The reason I couldn't see it is that the banner seems to be added AFTER onBannerLoaded() method is called.

    Hope it helps anyone in the future :)