0

我的应用程序中有广告。如果有人没有连接到互联网,我想绘制文本而不是 AD。广告进入应用程序后,我如何才能知道?有什么方法可以检测到吗?提前致谢

4

1 回答 1

1

您可以使用AdListener来检测您的 AdView 是否收到广告。

AdView adView = new AdView(activity, AdSize.BANNER, "xxxxxxxxxx");
adView.setAdListener(new AdListener() {
    @Override public void onReceiveAd(Ad arg0) {
        // This method is called when ad was received successfully
    }
    @Override public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
        // This method is called when ad cannot be received
    }
    @Override public void onPresentScreen(Ad arg0) {  }
    @Override public void onLeaveApplication(Ad arg0) { }
    @Override public void onDismissScreen(Ad arg0) { }
});
于 2013-09-04T05:38:48.173 回答