Native ad without adapter privacy click reset


#1

I try to display a native ad outside of an adapter. Everything works fine except that the privacy icon click listener is not set as it should

First, I tried to follow the official doc but it’s clearly outdated. The rendering part uses class (as AdapterHelper that have been deprecated.

So I used this kind of integration : Using Native Ads outside Mopub Adapter

To make it simple, here is the part of the code that has an issue.

final View view = nativeAd.createAdView(context, nativeAdContainer);
nativeAd.renderAdView(view);
nativeAd.prepare(view);

At some point, nativeAd.renderAdView will call NativeRendererHelper#addPrivacyInformationIcon. At that time the privacy information icon will have the right click listener.
However, nativeAd.prepare will call NativeClickHandler#setOnClickListener that will recursively set the ad click listener on all the view, reseting the privacy icon click.

Am I missing something here or is this an issue in the SDK?


#2

Hi there,

For a manual integration such as what you are doing, you can continue using AdapterHelper.getAdView() to get you the final populated ad view. The deprecation notice is not fatal and can be ignored.

You should actually call prepare() before renderAdView(). Let us know if that fixes the problem!