Интеграция Admob на проекте

Я хочу добавить службу admob в свое приложение, а затем установлю приложение в Google Play. Когда я выполняю процесс тестирования на эмуляторе, он работает, появляется тестовая реклама от admob, но затем, когда я устанавливаю приложение на google market, реклама от admob не появляется.

Когда я использую такой код, он работает:

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

но это тестовая реклама. Я хочу установить приложение в Google Play и работать там. Когда я использую этот код, он ничего не показывает.

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

Мой XML-код

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/arkafon_second_screen"
     >




        <com.google.android.gms.ads.AdView
            android:gravity="center"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            ads:adSize="BANNER"


            ads:adUnitId="ca-app-pub-4706271926046838/5956936636">
        </com.google.android.gms.ads.AdView>


    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"

        >

    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/bttnzikir"
        android:text="Günlük Zikir Sayısı"
        android:textStyle="bold"
        />

    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="...."
        android:textColor="#000000"
        android:textSize="20dp"

        android:id="@+id/txtzikir"

        />
    </LinearLayout>

    <LinearLayout 
          android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
    <Button
        android:textStyle="bold"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/bttnanlami"
        android:text="Zikir Niyeti"
        android:layout_marginTop="20dp"
        />


        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="....."
            android:textColor="#000000"
            android:textSize="20dp"

            android:layout_marginTop="20dp"
            android:id="@+id/txtanlami"
            />
        </LinearLayout>

    <LinearLayout
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <Button
            android:textStyle="bold"
            android:id="@+id/bttnzikircek"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp"
            android:paddingBottom="10dp"
            android:paddingTop="10dp"
            android:text="Allah"
            android:textSize="45dp" />



        <TextView
            android:id="@+id/txtzikircek"
            android:layout_width="230dp"
            android:layout_height="wrap_content"

            android:gravity="center"
            android:layout_marginTop="10dp"
            android:background="@drawable/button_gonder"

            android:text="0"
            android:textColor="#000000"
            android:textSize="45dp" />

        <Button
            android:layout_marginTop="10dp"
            android:background="@drawable/sifirla_btn"
            android:id="@+id/buttonreset"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />

    </LinearLayout>

</LinearLayout>

Как я могу сделать, чтобы приложение работало, чтобы показывать рекламу на живом устройстве?


person Diego    schedule 08.08.2017    source источник


Ответы (1)


Код вроде в порядке. Перепроверьте и дважды проверьте идентификатор рекламного блока в консоли admob.

person Saptak Das    schedule 08.08.2017
comment
Да я так же проверил - person Diego; 08.08.2017