您能在同一个活动中展示横幅广告和插页式广告吗?这违反AdMob政策吗?
例如,当您打开应用程序时,插页式广告会出现,当您关闭它时,横幅广告会出现,或者当横幅广告已经显示时,您会展示插页式广告。
是的,你可以。
查看文档以获取更多信息https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals
此外,您可能会发现使用“AdListener”非常有用!
adView.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
//Called when the user is about to return to the application after
super.onAdClosed();
}
@Override
public void onAdFailedToLoad(int errorCode) {
//Called when an ad request failed
super.onAdFailedToLoad(errorCode);
}
@Override
public void onAdLeftApplication() {
//Called when an ad leaves the application (e.g., to go to the browser)
super.onAdLeftApplication();
}
@Override
public void onAdOpened() {
//Called when an ad is received
super.onAdOpened();
}
@Override
public void onAdLoaded() {
//Called when an ad opens an overlay that covers the screen
super.onAdLoaded();
}
});
当然你可以在你的应用程序中同时展示横幅广告和插页式广告。这是代码:
在MainActivity.java文件的onCreate方法中添加以下代码: