【问题标题】:Admob banner not showing in real devicesAdmob 横幅未在真实设备中显示
【发布时间】:2017-05-23 05:08:01
【问题描述】:

在 Google 商店中使用我的应用程序 2 周后,我意识到横幅并未在真实设备中显示。当我用 Android Studio 虚拟设备测试它时,它很好。

这是我的 MainActivity 中与横幅相关的代码:

AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest request = new AdRequest.Builder().build();
    mAdView.loadAd(request);

和布局:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/gray_background">
    <com.flaviofaria.kenburnsview.KenBurnsView
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <LinearLayout
        android:layout_marginTop="?attr/actionBarSize"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context="misc.songbox.Search"
        android:orientation="vertical">

        <com.google.android.gms.ads.AdView

            android:id="@+id/adView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="@string/bannerAd">

        </com.google.android.gms.ads.AdView>

        <ListView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/listView"
            android:dividerHeight="0dp"
            />

    </LinearLayout>
</RelativeLayout>

【问题讨论】:

  • AdView 应该在最上层
  • 你是什么意思?

标签: android admob ads adsense


【解决方案1】:

使用这个 xml 代码...

<com.google.android.gms.ads.AdView

        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="@string/bannerAd">

    </com.google.android.gms.ads.AdView>

【讨论】:

  • 你认为是这个原因吗?
  • 是的,这也是原因,首先运行你的这个应用程序 5 屏幕尺寸并运行 4 屏幕尺寸然后你就会知道
【解决方案2】:

如果您能够加载测试广告但不能加载实时广告,这听起来像是您的 AdMob 帐户存在问题。您能否确保您正确设置了支付系统和/或验证了您的 PIN 码?如果未完成,则不会从您的帐户投放实时广告。

【讨论】:

  • 谢谢,但这不是问题,因为我的插页式广告正在工作并正在展示广告。但有些设备没有显示横幅。这让我非常紧张,因为我没有解决方案,也不知道该怎么做。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多