AbMod from Google Play services will perform undesired auto scrolling

324 views
Skip to first unread message

Yan Cheng Cheok

unread,
Nov 14, 2013, 1:48:11 AM11/14/13
to google-adm...@googlegroups.com

I were using AdMob from Google Play services version 13. I realize, when I place the advertisement withinScrollView, AdMob will try to perform undesired auto scrolling, after it fetches the advertisement successfully from server.

package com.example.admob_bug;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.LinearLayout;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Create the adView.
        adView = new AdView(this);
        adView.setAdUnitId("a151b03485063e0");
        adView.setAdSize(AdSize.BANNER);

        // Lookup your LinearLayout assuming it's been given
        // the attribute android:id="@+id/mainLayout".
        LinearLayout layout = (LinearLayout)findViewById(R.id.advertisement);

        // Add the adView to it.
        layout.addView(adView);

        // Initiate a generic request.
        AdRequest adRequest = new AdRequest.Builder().build();

        // Load the adView with the ad request.
        adView.loadAd(adRequest);        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public void onPause() {
        adView.pause();
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
        adView.resume();
    }

    @Override
    public void onDestroy() {
        adView.destroy();
        super.onDestroy();
    }

    private AdView adView;    
}

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    ...
    ...

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Large Text 7"
        android:layout_margin="30dp"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <LinearLayout
        android:id="@+id/advertisement"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Large Text 8"
        android:layout_margin="30dp"
        android:textAppearance="?android:attr/textAppearanceLarge" />        

</LinearLayout>

The complete source code can be downloaded from https://www.dropbox.com/s/e53zjqsc5cnilz2/admob_bug.zip

You will realize this problem, after you wait for around 10 seconds (Depending on network quality), after advertisement is loaded.

Is there any workaround to prevent auto scrolling?

Amy Quispe (AdMob SDK Team)

unread,
Nov 18, 2013, 7:49:42 PM11/18/13
to google-adm...@googlegroups.com
Hey there Yan!

I can't reproduce this. What device are you having a problem on?

Amy

Yan Cheng Cheok

unread,
Feb 8, 2014, 3:22:08 AM2/8/14
to google-adm...@googlegroups.com
Hi Amy,

Sorry for late reply. I just realize there is reply in this thread. I don't receive any email notification.

My device is Nexus S, Android 4.1.2

To-date, I testing using latest Google Play Service (14)

Problem still occur to-date. The list will auto scroll toward bottom

[Large Text 7]
[advertisement]

Any hint on solving this problem is very much appreciated, as AdMob jar SDK is going to depreciated on August 1, 2014

Thanks.
Cheok

Yan Cheng Cheok

unread,
Feb 14, 2014, 7:34:24 AM2/14/14
to google-adm...@googlegroups.com
Hi all,

Is there any update on this issue? :(

As having "auto scrolling" bug will create a bad user experience. If I can't find out a workaround on this issues before depreciation, I may need to switch to other advertising platform provider. That is not something I would like it to happen, as I'm a very happy AdMob user.

Thank you for your support.
Cheok

Kunal Verma

unread,
Feb 14, 2014, 10:41:35 AM2/14/14
to Google AdMob Ads Developers
Hi Yan,

The AdMob Ads if set inside a ScrollView will always scroll. However, what I have done is edited the activity_main.xml- setting up a Relative Layout in which there is a scrollview and a LinearLayout (which contains your ad) at the bottom. 
So when you scroll, the Ad doesn't scroll, it always remain in the view. 

Best,
Kunal



--
 
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

activity_main.xml
admob_bug 2.zip

Yan Cheng Cheok

unread,
Feb 15, 2014, 8:25:18 PM2/15/14
to google-adm...@googlegroups.com
Having advertisement at the bottom is not something I want to achieve. I only wish is to place it at the middle of scroll view.

Any how, I got a pretty nice workaround from others. Here's the workaround.

<LinearLayout
        android:id="@+id/advertisement"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:descendantFocusability="blocksDescendants"
        android:orientation="vertical" >
</LinearLayout>
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.

Temper Situ

unread,
May 30, 2014, 4:19:33 AM5/30/14
to google-adm...@googlegroups.com
add android:descendantFocusability="blocksDescendants" to the LinearLayout is work! thank you!

Yan Cheng Cheok於 2014年2月16日星期日UTC+8上午9時25分18秒寫道:


DISCLAIMER: This email may contain personal opinion of the sender. It may not constitute formal advice or commitment by the sender or New Media Group. This email and any attachment may contain confidential material. Any unauthorized use or dissemination is prohibited. If you are not the intended recipient, please delete it and notify the sender immediately. Emails are not secure and cannot be guaranteed to be error free.

免責聲明: 此電郵可能只含寄件者個人見解,而非寄件者或新傳媒集團之正式意見或承諾。此電郵及任何附件可能含機密資料,不得進行未經授權之使用及分發。如你並非指定收件者,請立即刪除並通知寄件者。電郵均非完全可靠,難以保證毫無錯誤。

Please consider the environment before printing this e-mail.
Reply all
Reply to author
Forward
0 new messages