Admob 广告不显示

Admob ads not showing up(Admob 广告不显示)
本文介绍了Admob 广告不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am trying to implement Admob in Android and I am seeing requests coming into AdMob. However, I am not seeing the Admob ads being displayed on the Android screen in the emulator and my Android test phones as well.

As stated before, I can see the requests coming into my AdMob account. However, the content is not being shown. Is there something that needs to be enabled in my account, the main.xml, AndroidManifest.xml, or in the loading of the application?

My application configuration and code are below. Please advise on what is needed. Thanks!

AndroidManifest:

          <meta-data 
            android:value="My Publisher ID"
            android:name="ADMOB_PUBLISHER_ID" />
        <activity android:name="com.admob.android.ads.AdMobActivity"/>
        <receiver 
            android:name="com.admob.android.ads.analytics.InstallReceiver"
            android:exported="true">
         <intent-filter>
         <action android:name="com.android.vending.INSTALL_REFERRER"/>
         </intent-filter>
         </receiver>
         <meta-data 
             android:value="true" 
             android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"/>

main:

 <com.google.ads.AdView
    android:id="@+id/adView"
   android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
    ads:adUnitId="My Publisher ID"
    ads:loadAdOnCreate="true"/>

On Create Code:

        AdView adView = (AdView)this.findViewById(R.id.adView);
        AdRequest re = new AdRequest();
        re.setTesting(true);
        adView.loadAd(re);

Any help is appreciated!!

解决方案

Make sure that the layout the AdView is embedded in does not impose any padding on the AdView. The AdView's size has to be exactly 320x50 dip. It does not show up if it does not get enough room.

Also check the log output of your device. In Eclipse switch to the DDMS perspective, select your device and watch the LogCat output.

这篇关于Admob 广告不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)