Can't see Mopub ads
err.. Sorry the problem was with the country. There was no ads in my country to show. I just checked with VPN, set my country to USA and there were ads :-)
I had the same problem in Revmob, so tried this. Thanks anyways.
No Ads Found' With MoPub Native Ads and Facebook
Under MoPub's Integrating 3rd Party Ad Networks it explains that a unique Ad Renderer is required for Facebook in addition to using a specific Facebook layout.
FacebookAdRenderer facebookAdRenderer = new FacebookAdRenderer(
new FacebookAdRenderer.FacebookViewBinder.Builder(R.layout.native_ad_list_item)
.titleId(R.id.native_title)
.textId(R.id.native_text)
// Binding to new layouts from Facebook 4.99.0+
.mediaViewId(R.id.native_main_image)
.adIconViewId(R.id.native_icon_image)
.adChoicesRelativeLayoutId(R.id.native_ad_choices_relative_layout)
.advertiserNameId(R.id.native_title) // Bind either the titleId or advertiserNameId depending on the FB SDK version
// End of binding to new layouts
.callToActionId(R.id.native_cta)
.build());
To know which specific layout elements to use in your XML for the MediaView, AdIconView, and AdChoices RelativeLayout in the FacebookViewBinder, please reference this sample XML layout. Additionally, depending on the Facebook SDK version you are integrating, you will need to show only either the ad title or the advertiser name. For more information about Facebook’s implementation requriements, check out this article.
Then, register your ad renderers, like below. Your classThatRegistersAdRenderers varies depending on which native ad integration you are using. Remember to register your MoPubStaticNativeAdRenderer instance last.
// MoPubRecyclerAdapter
MoPubRecyclerAdapter classThatRegistersAdRenderers = new MoPubRecyclerAdapter(...);
// MoPubStreamAdPlacer
MoPubStreamAdPlacer classThatRegistersAdRenderers = new MoPubStreamAdPlacer(...);
// MoPubAdAdapter
MoPubAdAdapter classThatRegistersAdRenderers = new MoPubAdAdapter(...);
// MoPubNative
MoPubNative classThatRegistersAdRenderers = new MoPubNative(...);
classThatRegistersAdRenderers.registerAdRenderer(
googlePlayServicesAdRenderer);
classThatRegistersAdRenderers.registerAdRenderer(
flurryNativeAdRenderer);
classThatRegistersAdRenderers.registerAdRenderer(facebookAdRenderer);
classThatRegistersAdRenderers.registerAdRenderer(staticAdRender);
Related Topics
I'M Getting a Nullpointerexception When I Use Action_Image_Capture to Take a Picture
How to Set The Font Style to Bold, Italic and Underlined in an Android Textview
How Surfaceholder Callbacks Are Related to Activity Lifecycle
Pcm -> Aac (Encoder) -> Pcm(Decoder) in Real-Time with Correct Optimization
Input Field Hidden When Soft Keyboard Appears in Phonegap
Create a Custom View by Inflating a Layout
Flutter: Upgrade The Version Code for Play Store
Why Bitmap to Base64 String Showing Black Background on Webview in Android
A Pre-Populated Database Does Not Work at API 28 Throws "No Such Table" Exception
Android Device Configuration for Aosp
How to Secure My App Against Piracy
Android Browser Bug? Div Overflow Scrolling
Fragmenttransaction Animation to Slide in Over Top