I want to use MoPub for mediation for Facebook Ads and Admob. I followed MoPub guides for this: Native Ads Integration and Integrating Native Third Party Ad Networks. Here is the code I create renderer for Admob and how I register it to MoPub ad adapter:
final GooglePlayServicesAdRenderer googlePlayServicesAdRenderer = new GooglePlayServicesAdRenderer(
new ViewBinder.Builder(R.layout.native_ad_list_item)
.titleId(R.id.native_title)
.textId(R.id.native_text)
.mainImageId(R.id.native_main_image)
.iconImageId(R.id.native_icon_image)
.callToActionId(R.id.native_cta)
.privacyInformationIconImageId(R.id.native_privacy_information_icon_image)
.build());
...
MoPubNativeAdPositioning.MoPubServerPositioning adPositioning =
MoPubNativeAdPositioning.serverPositioning();
moPubAdAdapter = new MoPubAdAdapter(getActivity(), normalArrayAdapter, adPositioning);
// moPubAdAdapter.registerAdRenderer(facebookAdRenderer);
moPubAdAdapter.registerAdRenderer(googlePlayServicesAdRenderer);
moPubAdAdapter.registerAdRenderer(moPubStaticNativeAdRenderer);
listView.setAdapter(moPubAdAdapter);
The R.layout.native_ad_list_item
is copied from here. I load ads in onResume()
as told in guides above as follows:
moPubAdAdapter.loadAds(getString(R.string.mopub_native_ad_unit_id));
My problem is that if I register googlePlayServicesAdRenderer
only, I get no ads. If I combine it with moPubStaticNativeAdRenderer
, I get Facebook ads, although I didn't register facebookAdRenderer
. I also get no log about Admob ads. What could be the case?
AdMob Native Ad Advanced is required for MoPub mediation but we have Native Ad Express. You should contact Google to be added to those who can create advanced ads from AdMob console.