【发布时间】:2015-05-10 22:31:47
【问题描述】:
我正在使用 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。 -
你的问题最后是怎么解决的?
-
你能解决这个问题吗?
-
如果您使用的是插页式广告,我认为您不需要在布局文件中添加任何内容。