【发布时间】:2015-01-14 21:47:43
【问题描述】:
插页式广告不会显示在我的应用程序中,我不知道该怎么办了。
注意: 我的应用尚未在 Google 的 Play 商店中列出。我希望这不会导致错误。
我做了什么:
我在 admob 的网站上制作了一个新的插页式广告。
我已将 Google Play 添加到我的项目中:
-
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@style/AppTheme.NoActionBar" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Google Play 服务版本为:
<integer name="google_play_services_version">6171000</integer>
- 我添加了
InterstitialAd对象
-
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
private InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstance) {
//
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(AD_UNIT_ID);
mInterstitialAd.setAdListener(mAdListener);
AdRequest.Builder builder = new AdRequest.Builder();
mInterstitialAd.loadAd(builder.build());
}
- 还有广告收听者:
-
private AdListener mAdListener = new AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
Functions.log("Ad loaded !");
}
}
方法:onAdLoaded() 未被调用。我离开应用程序 5 分钟,但没有得到回应。
我什至试图强迫show()
findViewById(R.id.btn_testAd).setOnClickListener(new View.OnCliclIstener() {
@Override
public void onClick(View v) {
mInterstitialAd.show();
}
});
我在 logcat 中得到了什么:
The interstitial has not loaded.
【问题讨论】:
-
刚刚遇到同样的问题。我正在测试显示插页式广告,但没有显示。基本上它没有加载任何东西。不知道为什么,我想我拥有一切。
标签: android admob interstitial