Re: SMART_BANNER Android Smart Banner Problems when View is initially loaded in landcape mode and is then switched to portrait mode.

3,389 views
Skip to first unread message

Eric Leichtenschlag

unread,
Jun 14, 2012, 8:41:49 PM6/14/12
to google-adm...@googlegroups.com
Hey Aaron,

You're correct, the AdView needs to be recreated if you're using SMART_BANNER and handling your own configuration changes.  Otherwise, the AdView size doesn't get changed, but the request is still for a full width ad in the new orientation, and so it doesn't fit.  Recreating the AdView in this case may be easier for you to do in code than via XML.

Cheers,
Eric

On Wed, Jun 13, 2012 at 8:17 PM, Aaron Dancygier <aaron.d...@gmail.com> wrote:
Hi Im encountering the following problem with the SMART_BANNER type.

If I load an ad in landscape mode and then switch to portrait mode I see the following error in logcat.

Not enough space to show ad! Wants: <1196, 64>, Has: <720, 100>

It doesn't seem to refreshing the AdView objects state.  I already have a handler for onConfigurationChanged() in the activity where I check orientation.  
Should I destroy the Adview completely and call ad.loadAd(new AdRequest())?  My AdView is defined in xml as follows.

<com.google.ads.AdView
        android:id="@+id/adViewDetail"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_marginBottom="1dp"
            android:background="@color/black"
            ads:adUnitId="XXXXXX"
            ads:adSize="SMART_BANNER"
            ads:testDevices="TEST_EMULATOR,XXXXXXXX"
/> 

   Activity =>

AdView ad = (AdView) findViewById(R.id.adViewDetail);
ad.loadAd(new AdRequest());

Thanks,

Aaron 

 



--


Nikhilesh Kshirsagar

unread,
Oct 22, 2013, 7:22:01 AM10/22/13
to google-adm...@googlegroups.com
I am using SMART_BANNER, so I tried removing the adview and added a new adview to current layout in onConfigurationChanged event but the ad request fails saying "network error". Did you by any chance got this to work?

Regards,
Nikhilesh

Eric Leichtenschlag

unread,
Oct 23, 2013, 6:30:37 PM10/23/13
to google-adm...@googlegroups.com
Hello Nikhilesh,

Pardon the obvious question, but are you sure your device has an internet connection? Network error generally means lack of an internet connection, and isn't related to using smart banners in onConfigurationChanged.

If you confirm that an internet connection is not a problem, could you provide more logging information from LogCat?

Thanks,
Eric

Nikhilesh Kshirsagar

unread,
Oct 25, 2013, 3:38:09 AM10/25/13
to google-adm...@googlegroups.com
Hey Eric,

I got it working, I was testing on emulator and yes it did had internet connection, the problem was I didn't specified the device type as Emulator.
It's working perfectly on the device though.

Eric Leichtenschlag

unread,
Oct 28, 2013, 4:55:29 PM10/28/13
to google-adm...@googlegroups.com
Cool, I'm glad you figured it out.

Michael T

unread,
Nov 12, 2013, 9:11:23 AM11/12/13
to google-adm...@googlegroups.com
Hi Eric,

I need your advice, I have the same issue of not getting ad after orientation changed.  Here is my logcat.  Thank for helping.

p.s: I'm pretty sure that my network connection is ok.

---
11-10 22:27:35.936: E/ActivityThread(6818): Failed to find provider info for com.google.plus.platform
11-10 22:27:35.966: I/Ads(6818): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":2,"session_id":"2461401996972352134","seq_num":"3","slotname":"publisher_id_hidden","u_w":984,"msid":"com.evol.stocklah.android","adtest":"on","js":"afma-sdk-a-v6.4.1","prnl":314,"bas_off":0,"imbf":"8009","net":"unknown","app_name":"30.android.com.evol.stocklah.android","hl":"en","smart_w":"full","gnt":0,"u_audio":1,"u_sd":0.8125,"ms":"uQetg4t-QoMjcQTiqGmRALQNYPCO3gcjDisG2Abzg_GZlKB5EdiCqQMrr_6bRO3MPSS6PyKnlQ01Psqit8mIoDqk7bZ2Mg7IsGmKzoP18IfTB8hn2dRCsVRtVuo1TyuO73XKh8OhhOAv5viNX1YV9AVsFMUvYbNp1GRQk4_RGOKdKHJ66GUMu3c0eO3Fnm6S1lJcPDOa0iHdz4B198nOxL8Yv4fgueb5RsdGdDzIEwxbcpvuHI0Jop1RQUKuXlP8ZDUuiV5McTv_Du8GWDeeskv9tdt_tYJuSI3anMToRzcfHUbptUCRkCshjnFoP5FbF-iawWeP5_ZxNFy4QTkdtA","mv":"80230011.com.android.vending","isu":"D84AC8676C76F5036E1C6C603C03CA59","format":"984x50_mb","oar":0,"smart_h":"auto","ad_pos":{"height":40,"visible":1,"y":512,"x":0,"width":800},"u_h":679,"pt":1,"bas_on":0,"ptime":14419,"prl":680});</script></head><body></body></html>
11-10 22:27:35.996: I/Ads(6818): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/gma?preqs=2&session_id=2461401996972352134&seq_num=3&u_w=984&msid=com.evol.stocklah.android&adtest=on&js=afma-sdk-a-v6.4.1&prnl=314&bas_off=0&imbf=8009&net=unknown&app_name=30.android.com.evol.stocklah.android&hl=en&smart_w=full&gnt=0&u_audio=1&u_sd=0.8125&ms=uQetg4t-QoMjcQTiqGmRALQNYPCO3gcjDisG2Abzg_GZlKB5EdiCqQMrr_6bRO3MPSS6PyKnlQ01Psqit8mIoDqk7bZ2Mg7IsGmKzoP18IfTB8hn2dRCsVRtVuo1TyuO73XKh8OhhOAv5viNX1YV9AVsFMUvYbNp1GRQk4_RGOKdKHJ66GUMu3c0eO3Fnm6S1lJcPDOa0iHdz4B198nOxL8Yv4fgueb5RsdGdDzIEwxbcpvuHI0Jop1RQUKuXlP8ZDUuiV5McTv_Du8GWDeeskv9tdt_tYJuSI3anMToRzcfHUbptUCRkCshjnFoP5FbF-iawWeP5_ZxNFy4QTkdtA&mv=80230011.com.android.vending&format=984x50_mb&oar=0&smart_h=auto&u_h=679&bas_on=0&ptime=14419&prl=680&u_so=l&output=html&region=mobile_app&u_tz=480&client_sdk=1&ex=1&slotname=a1524a2026563b8&askip=2&gsb=unkwn&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_sdkAdmobApiForAds_di&eisu=NRDXeg8kfIOhm_rkQdeJoAYtcSf20HNbl6K_0SfX33NwXndrzzF7r78GxZZvJGreD4A5MBEwwf_V6mjESS6qTNvZsyn6fYN32phrK-9RLGEXNn068OA0_FampMIkt4zR&et=1&jsv=57" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
11-10 22:27:35.996: I/Ads(6818): Request scenario: Online server request.
11-10 22:27:36.516: D/webviewglue(6818): nativeDestroy view: 0xb8bcbf90
11-10 22:27:36.516: I/Ads(6818): onReceiveAd()
11-10 22:27:49.246: D/dalvikvm(6818): GC_CONCURRENT freed 763K, 12% free 6372K/7200K, paused 2ms+11ms, total 18ms
11-10 22:27:49.376: E/ActivityThread(6818): Failed to find provider info for com.google.plus.platform
11-10 22:27:49.456: I/Ads(6818): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":3,"session_id":"2461401996972352134","seq_num":"4","slotname":"publisher_id_hidden","u_w":738,"msid":"com.evol.stocklah.android","adtest":"on","js":"afma-sdk-a-v6.4.1","bas_off":0,"imbf":"8009","net":"unknown","app_name":"30.android.com.evol.stocklah.android","hl":"en","smart_w":"full","gnt":0,"u_audio":1,"u_sd":0.8125,"ms":"UpVAWuxwpFtz1W8tikmHUZK4dlor0ULA_1cgtkasrp0EF9jRpI4w-KiNMOp904Ra35hJ92gEHxDg-7L38kKKjpzRYGimj_9Tcu_YoSSWrvBGCIyQNzfTUi0qiyCbCLAZV_6xKt2xxI7_ZykWUP5hHDAP8_3sV4dmCgKcdUIspGQOlJ1v31ZU9gMW-yc0PTD-NGt5WqZSWW5grJ1GW01yB2NFCqX8GX3HIxUUtT8YseC0W0Yoc78z26VQokJuRL8WiGeSZPbP0Xbvfl8DZTZGPzQl-C0UAgbuEYyVCTCYg7UrgzbWxJMaWKb9m5H1UHxxrgD-4vFg58cEAHCkXYz2rA","mv":"80230011.com.android.vending","isu":"D84AC8676C76F5036E1C6C603C03CA59","format":"738x90_mb","oar":0,"smart_h":"auto","ad_pos":{"height":0,"visible":0,"y":25,"x":0,"width":0},"u_h":925,"pt":1,"bas_on":0,"ptime":27859});</script></head><body></body></html>
11-10 22:27:49.566: D/dalvikvm(6818): GC_FOR_ALLOC freed 1609K, 33% free 4845K/7200K, paused 24ms, total 24ms
11-10 22:27:49.606: I/dalvikvm-heap(6818): Grow heap (frag case) to 6.414MB for 1744812-byte allocation
11-10 22:27:49.606: D/dalvikvm(6818): GC_FOR_ALLOC freed <1K, 27% free 6549K/8904K, paused 5ms, total 5ms
11-10 22:27:49.616: D/dalvikvm(6818): GC_CONCURRENT freed <1K, 27% free 6548K/8904K, paused 2ms+0ms, total 6ms
11-10 22:27:49.906: I/Ads(6818): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/gma?preqs=3&session_id=2461401996972352134&seq_num=4&u_w=738&msid=com.evol.stocklah.android&adtest=on&js=afma-sdk-a-v6.4.1&bas_off=0&imbf=8009&net=unknown&app_name=30.android.com.evol.stocklah.android&hl=en&smart_w=full&gnt=0&u_audio=1&u_sd=0.8125&ms=UpVAWuxwpFtz1W8tikmHUZK4dlor0ULA_1cgtkasrp0EF9jRpI4w-KiNMOp904Ra35hJ92gEHxDg-7L38kKKjpzRYGimj_9Tcu_YoSSWrvBGCIyQNzfTUi0qiyCbCLAZV_6xKt2xxI7_ZykWUP5hHDAP8_3sV4dmCgKcdUIspGQOlJ1v31ZU9gMW-yc0PTD-NGt5WqZSWW5grJ1GW01yB2NFCqX8GX3HIxUUtT8YseC0W0Yoc78z26VQokJuRL8WiGeSZPbP0Xbvfl8DZTZGPzQl-C0UAgbuEYyVCTCYg7UrgzbWxJMaWKb9m5H1UHxxrgD-4vFg58cEAHCkXYz2rA&mv=80230011.com.android.vending&format=738x90_mb&oar=0&smart_h=auto&u_h=925&bas_on=0&ptime=27859&u_so=p&output=html&region=mobile_app&u_tz=480&client_sdk=1&ex=1&slotname=a1524a2026563b8&askip=3&gsb=unkwn&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_sdkAdmobApiForAds_di&eisu=ypJhc9_Wpy0i0ChK79wHx6DJ0PUbhF7vnHSXa4ju8b1iTrT2-HBzdK-8x6tw4UZQSkCVt0gFp-dEpuV4VGpnHH_XAK-UWQUjqJp2ZwVv4xzX146FJ3LN09iJT4_Vnrie&et=1&jsv=57" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
11-10 22:27:49.916: I/Ads(6818): Request scenario: Offline with no buffered ads.
11-10 22:27:49.916: I/Ads(6818): Network is unavailable.  Aborting ad request.
11-10 22:27:49.926: D/webviewglue(6818): nativeDestroy view: 0xb89ff490
11-10 22:27:49.926: I/Ads(6818): onFailedToReceiveAd(A network error occurred.)

---

James

unread,
Nov 12, 2013, 9:04:14 PM11/12/13
to google-adm...@googlegroups.com
Hi,

This post may be helpful. In this example, it doesn't need to create a new AdView.



--
 
---
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.

Michael T

unread,
Nov 12, 2013, 9:18:21 PM11/12/13
to google-adm...@googlegroups.com
Not true James.  For smart banners, you need to create new AdView when there is change in orientation.

James

unread,
Nov 12, 2013, 10:29:03 PM11/12/13
to google-adm...@googlegroups.com
I see. Thanks


Eric Leichtenschlag

unread,
Nov 14, 2013, 4:01:59 PM11/14/13
to google-adm...@googlegroups.com
Hi Michael,

Can you try running this again? We just made a javascript update that should prevent the SDK from ever getting into that request scenario "Offline with no buffered ads." Hopefully this fixes the issue altogether - if not, at least there will be some more relevant information from the logs.

Thanks,
Eric
I see. Thanks


To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.

Michael T

unread,
Nov 14, 2013, 9:20:34 PM11/14/13
to google-adm...@googlegroups.com
My apology Eric, this post is a duplication of https://groups.google.com/forum/#!topic/google-admob-ads-sdk/8MCNsiVAc7A which the update on the javascript seem to work perfectly.  :)

3C Tools

unread,
Oct 22, 2019, 5:04:10 AM10/22/19
to google-adm...@googlegroups.com
6 years later... the latest library version... recreating adview entirely no longer works as expected and this issue re-appear!

It seems to me that the library is caching the orientation as it will take a few minutes before new ads are loaded for the proper orientation!

Is  there a way to force the orientation in the ad request or ad view?

Tried re-initializing all with MobileAds.initialize but it didn't help in any ways.
Also tried restarting the app, orientation of loaded ads is still incorrect, only time seems to fix this.

Hard to believe users are expected to wait a few minutes to get an appropriate experience with apps containing ads.

EDIT: using this com.google.android.gms:play-services-ads:18.2.0

Mobile Ads SDK Forum Advisor Prod

unread,
Oct 22, 2019, 7:49:38 AM10/22/19
to andro...@gmail.com, google-adm...@googlegroups.com
Hi there,

Thank you for contacting us. However, please refrain from reopening the old threads. You may always open a new thread on forum and we will be happy to assist you. 

With regard to your inquiry, please do note that Smart Banners detect the width of the device in its current orientation and create the ad view that size. There is no way to force the orientation in the ad request or ad view.

Could you confirm if you're seeing "Not enough space to show ad! Wants: <1196, 64>, Has: <720, 100>" error the same on this original thread? If so, I tried this to our sample app and I wasn't able to reproduce the issue on my end. That said, would it be possible for you to provide a sample reproducible project (via Reply Privately to Author option) so I could check it on my end? In addition, could you try our Adaptive Banners and let me know if you still encounter the same behavior?

Regards,
Teejay Pimentel
Mobile Ads SDK Team

ref:_00D1U1174p._5001UKO47E:ref
Reply all
Reply to author
Forward
0 new messages