Search code examples
androidadmobads

AdMob Native express ads are not working


I have integrated AdMob Native Express ad in my android app. It is working fine with devices having 5.5 inch display but it is not showing up on device having 4.5 and 5.0 inch display.

This is my Xml

 <com.google.android.gms.ads.NativeExpressAdView
 android:id="@+id/adView"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 ads:adUnitId="ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX"
 ads:adSize="360x100"
 android:layout_below="@+id/buttonspace2"
 android:visibility="gone">
</com.google.android.gms.ads.NativeExpressAdView>

Initially i am setting the visibility of the ad to Gone but once the ad is loaded I am setting it to Visible.

And this is how i am loading the ad

  final NativeExpressAdView adView = (NativeExpressAdView)findViewById(R.id.adView);

        AdRequest request = new AdRequest.Builder()


                .build();



        adView.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                adView.setVisibility(View.VISIBLE);
            }
        });
        adView.loadAd(request);

I have tested the above code with android device running on android 6.0 with 5.5 inch display it is working fine. But the problem is it is not working with android device running on android 5.0 with 4.5 and 5.0 inch display.


Solution

  • Solved the issue by changing the adsize from "360x100" to "280x100".

    EDIT:"FULL_WIDTHx100" can also be used.