2017-06-13 119 views
1

我測試了橫幅廣告與測試ID顯示,它在顯示精細,在那之後我procceeded改變adUnitId設置到實際的ID的AdMob給了我和我在應用程序分類中初始化MobileAds。我在Play商店中發佈了我的應用,並將其關聯到AdMob,並配置了付款資料。 AdMob表示橫幅廣告處於活動狀態,但我下載了我的應用並重新安裝,並且廣告未顯示。我可以錯過一些步驟嗎?Android的AdMob的面板說,橫幅廣告是積極的,但它不是我的應用程序

相關代碼:

這是應用程序類:

public class MyApplication extends Application { 

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

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

    } 

在橫幅廣告是爲了顯示活動:

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商店關聯,並且我已經配置了付款資料。還有其他的步驟嗎?我需要等多久才能顯示應用程序?

+0

你看到日誌什麼? –

+0

我連接了設備並觀看了logcat一分鐘,但我什麼也沒看到。反正一個朋友告訴我他可以看到廣告。也許我不能看到他們,因爲我是開發人員? –

回答

0

有時廣告花費幾個小時才能顯示出來,這是因爲沒有足夠的數據來顯示在您的應用程序相關的廣告。

如果你的應用程序是在Play商店中目前嘗試使用谷歌diferent帳戶下載它在其他設備上,如果你能SE的廣告,所以沒有問題。

+0

好吧,其他人都可以看到廣告,但我。也許這是因爲我的Google帳戶與開發者帳戶相同?無論如何,非常感謝你! –

+0

我也忘了,如果你正在運行的應用程序(即一個Android的工作室installas文你從IDE運行的應用程序)的調試版本的廣告就不會顯示爲「secury」的原因,因此,如果您在自己的廣告點擊沒有被禁止的風險,但無論如何,不​​要點擊它們。 –

相關問題