【发布时间】:2018-04-11 08:54:01
【问题描述】:
我正在使用 AdMob 来展示 Android 广告。测试广告运行良好,但未显示真实广告。另外,我遇到了真正的插页式广告和横幅广告都不起作用的问题。这里是我的代码:
banner_ads.xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<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_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
<!-- i have used a test ads over here -->
</com.google.android.gms.ads.AdView>
</RelativeLayout>
MainActivity.java
private AdView mAdView;
AdView = fragView.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
<!--for interstitial -->
InterstitialAd mInterstitialAd;
mInterstitialAd = new InterstitialAd(getApplicationContext());
// i have used a test id
mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
如何更改我的代码以便同时显示实时广告?
【问题讨论】: