2011-09-26 102 views
1

时,当我把我的酒吧IDAdMob广告request.setTesting(假)

AdView adView = new AdView(this, AdSize.BANNER, Publisher ID); 

layout.addView(adView); 


AdRequest request = new AdRequest(); 
request.setTesting(true); 

adView.loadAd(request); 

iam getting the ads but when i set it to 
request.setTesting(false) 

我没有得到广告如何解决这个..什么是实际不显示问题?

+0

我有类似的问题 –

+0

嘿史密斯..我实际上得到了解决方案离子它。它需要1-2天才能得到广告......并且还要检查你的admob设置 – Sando

回答

0

在XML中添加横幅要容易得多!

 <com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="xxxxxxxxxxx" 
    ads:loadAdOnCreate="true" 


    ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" /> 

,并在活动中只放

AdView adView = (AdView)this.findViewById(R.id.adView); 
    adView.loadAd(new AdRequest()); 
1

使用此在您的活动:

adview = (AdView) findViewById(R.id.adView); 
AdRequest re = new AdRequest(); 
re.addTestDevice(AdRequest.TEST_EMULATOR); // Emulator 
re.addTestDevice("xxxxxxxxxxx"); // Test Android Device 
adview.loadAd(re); 

使用此在XML文件中:

<com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
     ads:adSize="BANNER" 
     ads:adUnitId="xxxxxxxxxx" 
     ads:loadAdOnCreate="true"> 
</com.google.ads.AdView>