MoPub Native Ads not showing


#1

Hi All,

Hoping you can help me, I have reached out to MoPub but have not had any replies so hoping you guys can help.

I have recently integrated the MoPub SDK into an app I am working on along with the Facebook Audience Network Adapter as I plan on using MoPub for Ad Mediation. Integration appears to have been successful, I can see in the logs that the positioning is being grabbed from the server successfully and when I click the link for the ad I can see the JSON for the ad so I know I am getting an ad in my app.

Problem is that the ad does not show in the NativeAdRecycerViewAdapter, if I add an item to the original adapter, the NativeAdRecyclerViewAdapter picks it up and it is shown in the RecyclerView, it is just the ads that are not being displayed at all. There are no errors being displayed. Here is a copy of the log:

04-19 13:03:40.446 3343-3343/uk.co.handy_apps.memories D/MoPub: Loading positioning from: http://ads.mopub.com/m/pos?id=bb219243c3f64b95a64da2e8a8b62076&v=1&nsv=4.20.0&dn=Google%2CPixel%20XL%2Cmarlin&av=1.0&udid=mp_tmpl_advertising_id&dnt=mp_tmpl_do_not_track
04-19 13:03:40.648 3343-3343/uk.co.handy_apps.memories I/MoPub: ManifestUtils running without interstitial module
04-19 13:03:40.671 3343-3343/uk.co.handy_apps.memories D/MoPub: Loading ad from: http://ads.mopub.com/m/ad?id=bb219243c3f64b95a64da2e8a8b62076&nsv=4.20.0&dn=Google%2CPixel%20XL%2Cmarlin&bundle=uk.co.handy_apps.memories&z=%2B0100&o=p&w=1440&h=2560&sc_a=3.5&mcc=234&mnc=30&iso=gb&cn=Virgin&ct=3&av=1.0&udid=mp_tmpl_advertising_id&dnt=mp_tmpl_do_not_track&MAGIC_NO=0
04-19 13:03:41.352 3343-3343/uk.co.handy_apps.memories D/MoPub: Attempting to invoke custom event: com.mopub.nativeads.MoPubCustomEventNative

And here is my implementation of the adapter:

ViewBinder viewBinder = new ViewBinder.Builder(R.layout.view_native_ad)
.mainImageId(R.id.native_ad_main_image)
.iconImageId(R.id.native_ad_icon_image)
.titleId(R.id.native_ad_title)
.textId(R.id.native_ad_text)
.privacyInformationIconImageId(R.id.native_ad_privacy_information_icon_image)
.build();
MoPubNativeAdPositioning.MoPubServerPositioning positioning = MoPubNativeAdPositioning.serverPositioning();
MoPubStaticNativeAdRenderer renderer = new MoPubStaticNativeAdRenderer(viewBinder);
final MoPubRecyclerAdapter moPubAdAdapter = new MoPubRecyclerAdapter(this, adapter);
moPubAdAdapter.registerAdRenderer(renderer);
RecyclerView recyclerEvents = findViewById(R.id.recyclerEvents);
recyclerEvents.setLayoutManager(new LinearLayoutManager(this));
recyclerEvents.setAdapter(moPubAdAdapter);
AppCompatButton btnAddMedia = findViewById(R.id.btnAddMedia);
btnAddMedia.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
moPubAdAdapter.loadAds(“bb219243c3f64b95a64da2e8a8b62076”);
}
});

Hope you guys can aid me in this.

Thanks


#2

Did u register Facebook AdRenderer?
https://developers.mopub.com/docs/android/integrating-networks/


#3

Hi, Had another play around and started to work.

Took the sample code and experimented. Only difference I could see what that I set the recyclerview adapter before loading the ads whereas the sample loads the ads then sets the adapter.

Can’t imagine this making a difference but seems to be working now.

Thanks for the assistance.

Jamie