I have the following in all of my activities:
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="..."
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
ads:loadAdOnCreate="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
The problem with this is that it reloads the ad every time I switch between activities, so there is a short period of time when no ad is displayed. Some applications don't have this problem, for example Bubble Shoot: when switching between activities, the ad doesn't disappear at all.
How can I achieve this effect? I tried setting loadAdOnCreate="false"
and using a global AdRequest
, but this still seems to recreate the actual control, so there is still a (very short, but noticeable) period when there is no ad displayed.
Note: I need this to work for all API levels >= 7 ideally. If not possible, >= Android 2.3 / API level 9 is also acceptable. It must also be independent of device type and screen size.