首页 文章

Android AdMob面板显示 Banner 广告处于有效状态但未在我的应用中显示

提问于
浏览
1

我测试了带有测试ID的 Banner 广告并且它显示正常,之后我继续将adUnitId更改为实际的Id AdMob给了我并且我在应用程序clas中初始化了MobileAds . 我在Play商店发布了我的应用,将其与AdMob相关联,并配置了付款资料 . AdMob表示 Banner 广告处于有效状态,但我下载了我的应用并重新安装了广告并且广告未显示 . 我可以错过一些步骤吗?

相关守则:

这是应用程序类:

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        MobileAds.initialize(getApplicationContext(), "ca-app-pub-8983537837429131~3925299209");

    }

Banner 广告应显示的活动:

public class EntryActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_entry);

        Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        final AdView adView = (AdView)this.findViewById(R.id.adView);

        AdRequest adRequest = new AdRequest.Builder().build();

        adView.loadAd(adRequest);
}

它是xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/entryActivityLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads‌​"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:focusable="true"
    android:focusableInTouchMode="true"
    tools:context="com.bastardo.francisco.fitjournal.activities.EntryActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>


    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="My-banner-ad-Id"/>

</RelativeLayout>

正如我所说,测试广告显示得很好,但真正的广告没有显示 . 我的应用与AdMob中的Play商店相关联,我已经配置了付款资料 . 还有其他步骤吗?我需要等多久才能显示应用程序?

1 回答

  • 0

    有时广告需要几个小时才会显示,这是因为没有足够的数据在您的应用中显示相关广告 .

    如果您的应用程序是Playstore中的最新应用程序,请尝试使用不同的Google帐户在其他设备中下载该应用程序,如果您可以查看广告以便没有问题 .

相关问题