Reputation: 725
I have added the native express adview from firebase into my app it loads fine when i use the test id provided by them but when i replaced it with my publisher id and unit id,it stops displaying it
LogCat
Starting ad request.
Use AdRequest.Builder.addTestDevice("3C5C50F4B6108021A73AB0588B9E62C0") to get test ads on this device.
There was a problem getting an ad response. ErrorCode: 0
Failed to load ad: 0
Ad is not visible. Not refreshing ad.
Scheduling ad refresh 60000 milliseconds from now.
Code XML
<com.google.android.gms.ads.NativeExpressAdView
android:id="@+id/adView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center_horizontal|center"
ads:adSize="FULL_WIDTHx80"
ads:adUnitId="@string/ad_unit_id">
</com.google.android.gms.ads.NativeExpressAdView>
JAVA
MobileAds.initialize(getApplicationContext(), APIClass.PUBLISHER_ID);
NativeExpressAdView adView = (NativeExpressAdView) findViewById(R.id.adView1);
adView.loadAd(new AdRequest.Builder().build());
Will the ads get displayed when i add publish the app to play store
Upvotes: 2
Views: 7917
Reputation: 265
try one of this sizes:
XML:
ads:adSize="320x50; // BANNER
ads:adSize="468x60; // FULL_BANNER
ads:adSize="320x100; // LARGE_BANNER
ads:adSize="728x90; // LEADERBOARD
ads:adSize="300x250; // MEDIUM_RECTANGLE
ads:adSize="160x600; // WIDE_SKYSCRAPER
Java:
AdSize.BANNER
AdSize.FULL_BANNER
AdSize.LARGE_BANNER
AdSize.LEADERBOARD
AdSize.MEDIUM_RECTANGLE
AdSize.WIDE_SKYSCRAPER
example:
setAdSize(AdSize.BANNER)
or
setAdSize(new AdSize(320,50))
Upvotes: 0
Reputation: 6360
With Native Ads Express, your NativeExpressAdView size needs to fit in the range of sizes you picked in the AdMob Front-end. In this case, Smart banner is not big enough.
See the Choosing a Size section in the docs for what the ranges are for the Native Ads Express templates. Now see how the sizing of Native Ads Express works, since you chose SMART_BANNER as your size (FULL_WIDTHx80).
Let's say you're running this app on a Nexus 5 in portrait. The smart banner will be sized at
360x50
. When you compare that against the requirements for the Native Ads Express templates, you'll see that even the Small template requires a height of 80dp. Because your size doesn't fit the requirements, you won't ever see an ad.Try changing the size to ads:adSize="300x250". That size fits all 3 templates, and so you should get an ad back. I just tested it myself and it worked for your ad unit. For more precise measurements, double check which size you picked on the AdMob front-end, and make sure the width and height of your ad fits within the ranges.
We'll investigate more internally why the error code indicates internal error. This could be surfaced a bit better. However, I'm going to close this issue though for the reasons mentioned above.
Answered from here
Upvotes: 11