安卓&AdMob:何时调用AdView.loadAd [英] Android & AdMob: When to call AdView.loadAd

查看:89
本文介绍了安卓&AdMob:何时调用AdView.loadAd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

何时是从AdMob加载新广告的最佳时机"?

when is the "best moment" to load a new ad from AdMob?

我正在编程一个购物清单应用程序,该应用程序的主屏幕上有一个admob标语.

I'm programming a shopping list application that has an admob banner on its main screen.

首先我打电话

 m_AdView.loadAd(new AdRequest());

在onCreate()方法中.但是,所以我总是显示相同的广告.

in the the onCreate() method. But so I always got displayed the same ad.

现在,我想将呼叫放入onResume()中.但是难道没有机会引起太多的网络流量吗?

Now I want to put the call into onResume(). But isn't there the chance to cause too much network traffic?

推荐答案

同样的想法(谈论横幅广告而不是非页内广告)

Wondering the same (talking about Banner not Interstitial )

我在网上发现的大多数例子将请求( adView.loadAd(new AdRequest()))加载到 onCreate 中.

Most examples I found on the net load the request (adView.loadAd(new AdRequest())) in onCreate.

,但可以为 onStart :

public void onStart() {
    super.onStart();
    if(adView != null) {
        adView.loadAd(new AdRequest());
    }

根据: onCreate中的AdMob广告确定,但是如果您恢复活动就消失了,为什么?

在活动生命周期中,在 onCreate

In Activity life cycle, OnStart is called just after onCreate

https://developer.android.com/guide/components/activities/activity-lifecycle.html

所以...我听起来也不错的地方

so... I thing sound good place too

这篇关于安卓&AdMob:何时调用AdView.loadAd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆