4

I'm using the latest android admob SDK 6.3.1 and the first ad is downloaded and is shown on the device. Then after the refresh rate time is due, in my case 30 seconds, logcat shows that the ad has been downloaded and the new add is shown correctly. However after a second or less the new ad disappears leaving the space where the add should be blank.

Through trial and error I have found that if I touch the blank space where the ad should be it opens the correct 2nd ad link in the browser. So the add appears to be hidden in some way.

Also if I touch the bottom left hand corner of the blank 2nd ad, then the 2nd ad is shown correctly.

I've tried this with both relative and linear layouts and on different devices but the same thing happens. The first Ad shows correctly, after the refresh interval, the 2nd and all subsequent ads are downloaded and briefly displayed before going blank.

As well as trying different layouts I have also tried setting adview code in XML and programmatically in java source.

That fact that I briefly see the 2nd ad confirms that everything is okay admob server side so that makes me think it's the layout. But I have tried every combination can think of without success.

Ive tried setting: android:layout_width="320dp" android:layout_height="50dp" instead of "wrap_content" or "fill_parent".

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">
    <com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="xxxxxxxxxxxxxxxx"
                     ads:adSize="BANNER"
                     ads:loadAdOnCreate="true"/>
    </LinearLayout>

This is what I have now which is as per the official admob page.

Manifest

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <activity
        android:name="com.google.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

This is my third day trying to solve this, has anyone got any clues?

Mark
  • 1,360
  • 3
  • 20
  • 37
  • That sounds very odd. What do the logs say? Did you get the onReceiveAd() callback? Are you by any chance messing with the AdView's visibility in your code? – Eric Leichtenschlag Apr 17 '13 at 22:35
  • Eric, yes I see the onReceiveAd() callback I even see the new Ad briefly before it disappears. It's all set as basic as can be so not setting colors etc. Tis driving me mad as it's happening in all 5 of my apps – Mark Apr 18 '13 at 11:10
  • 1
    Can you download the [Android Fundamentals](https://code.google.com/p/google-mobile-dev/downloads/list) sample project, include the latest SDK, and run the app to see if it still happens? – Eric Leichtenschlag Apr 18 '13 at 16:58
  • It happens with my android app too. And the same with the sample project. – Dani Jun 12 '13 at 23:29
  • Also, I noticed that if the new ad after refresh is animated, it doesn't disappear. Next, when refresh with a static ad, it disappear again. – Dani Jun 13 '13 at 07:36

3 Answers3

0

Do you think it could be device specific. Or API specific.

Mark
  • 1,360
  • 3
  • 20
  • 37
0

Best Answer for This Question is that :-

You can set up an Animation to slide the banner down, and when it's out of the view (setup a onAnimationComplete listener) call it's method :

Code in Activity:- For visible:-

setVisibility(View.VISIBLE);

For:not Hide

setVisibility(View.INVISIBLE);

so it will not take up space in layout any more.

Amitsharma
  • 1,577
  • 1
  • 17
  • 29
0

I'm pretty sure this can happen if the same adview id name is used in more than one activity xml. android:id="@+id/adMob1"

Mark
  • 1,360
  • 3
  • 20
  • 37