我有一个带有2个屏幕的ViewPager。您可以滑动以在这两个片段之间导航。
One of the fragments contains ads at the bottom.
问题是当我从广告片段导航到另一个片段(广告屏幕现在不可见)ads ARE STILL LOADING!!!!
时,这导致点击率非常低,因为他们正在加载但用户看不到。
当广告屏幕不可见时,以下是来自控制台的一些粘贴:
10-29 23:03:32.955: I/Ads(10391): Starting ad request.
10-29 23:03:32.965: I/Ads(10391): Use AdRequest.Builder.addTestDevice("FE742438514BB5FC16E661BDF9966519") to get test ads on this device.
10-29 23:03:32.975: I/Ads(10391): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
10-29 23:03:33.566: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:03:33.566: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
10-29 23:03:34.166: I/Ads(10391): Scheduling ad refresh 55000 milliseconds from now.
10-29 23:03:34.176: I/Ads(10391): Ad finished loading.
10-29 23:03:42.565: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:03:42.565: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
10-29 23:04:01.553: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:04:01.553: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
10-29 23:04:29.170: I/Ads(10391): Starting ad request.
10-29 23:04:29.170: I/Ads(10391): Use AdRequest.Builder.addTestDevice("FE742438514BB5FC16E661BDF9966519") to get test ads on this device.
10-29 23:04:29.180: I/Ads(10391): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
10-29 23:04:30.491: I/Ads(10391): Scheduling ad refresh 55000 milliseconds from now.
10-29 23:04:30.491: I/Ads(10391): Ad finished loading.
10-29 23:04:33.564: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:04:33.564: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
10-29 23:04:42.563: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:04:42.563: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
10-29 23:05:01.552: I/Ads(10391): Ad is not visible. Not refreshing ad.
10-29 23:05:01.562: I/Ads(10391): Scheduling ad refresh 60000 milliseconds from now.
ViewPage适配器代码:
public class AudioRecPagerAdapter extends FragmentStatePagerAdapter {
private ArrayList<Fragment> registeredFragments = new ArrayList<Fragment>();
public AudioRecPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int index) {
Fragment fg = null;
switch (index) {
case 0:
fg = new RecorderFragment();
break;
case 1:
fg = new PlayerFragment();
break;
default:
break;
}
return fg;
}
@Override
public Object instantiateItem(ViewGroup arg0, int arg1) {
Fragment fg = (Fragment)super.instantiateItem(arg0, arg1);
registeredFragments.add(fg);
return fg;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
registeredFragments.remove(position);
super.destroyItem(container, position, object);
}
@Override
public int getCount() {
return 2;
}
public Fragment getRegisteredFragment(int position){
return registeredFragments.get(position);
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return AudioRecApplication.getInstance().getApplicationContext().getString(R.string.recorder_tab_name);
case 1:
return AudioRecApplication.getInstance().getApplicationContext().getString(R.string.player_tab_name);
default:
return super.getPageTitle(position);
}
}
}
答案 0 :(得分:1)
虽然AdView仍在检查是否要求广告,但日志显示它显然没有这样做,因为AdView不可见。因此,这不会影响您的点击率,因为广告永远不会被请求或显示。