I am curious how to load a webview when clicking on a mopub ad. By default the ad is opening a browser. There is very little documentation on this and I haven't been able to find any examples.
I instantiate the AdView class that I found in the mopub api as it seems like it should do what I want but to no avail. And I'm still not sure how to switch the ad click from browser to webview.
Also, getClickThroughUrl() returns null. Mopub is storing the url though because the page opens in a browser. So how do I properly retrieve the URL?
Here's my code:
mAdView.setAdUnitId(MOPUB_SALES_LIST_ID);
mAdView.loadAd();
mAdView.setOnAdLoadedListener(new OnAdLoadedListener() {
public void OnAdLoaded(MoPubView mpv) {
adPopupLayout.setVisibility(View.VISIBLE);
}
});
mAdView.setOnAdClickedListener(new OnAdClickedListener() {
@Override
public void OnAdClicked(MoPubView m) {
AdView adview = new AdView(getApplicationContext(), mAdView);
adview.loadUrl(m.getClickthroughUrl());
}
});