我在使用Admob来展示Android广告。测试广告正常显示,但真实广告没有显示。而且,我没有遇到真实插页式广告的任何问题,它们正常工作。只有真实横幅广告没有显示出来。以下是我的Java代码:
private InterstitialAd interstitial;
interstitial = new InterstitialAd(MainActivity.this);
interstitial.setAdUnitId("ca-app-pub-********");
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
// Add a test device to show Test Ads
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("4CCC00EF4EA205A6FE82E1AEB26B0839")
.build();
// Load ads into Banner Ads
adView.loadAd(adRequest);
// Load ads into Interstitial Ads
//interstitial.loadAd(adRequest);
布局文件是
<?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="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-********" />
</LinearLayout>
AndroidManifest.xml
。发布build.gradle
。 - Jared Burrows