SmartBanner height in mediation

98 views
Skip to first unread message

Chris

unread,
Jun 7, 2015, 9:56:26 AM6/7/15
to google-adm...@googlegroups.com
I am using the SmartBanner with mediation using CustomEvents. The problem is that on some small devices in landscape the Smart Banner is only ~30dp in height but my other banners in mediation are minimum 50dp in height. If I leave it like it is then the banners in mediation are cut in half. Now I am forced to create a Layout with a minimum height of 50dp so my CustomEvent works but the SmartBanner use only half of that and looks bad. Is there a way to force the SmartBanner to use the entire 50dp height? (My app is landscape only so this happens often)

Elton Kent

unread,
Jun 8, 2015, 2:13:11 PM6/8/15
to google-adm...@googlegroups.com, sopt...@gmail.com
Hello Chris,
Thanks for reaching out. It certainly does not look good to see a banner cut in half. There are two things that could be going wrong here. Firstly, I would recommend looking at your layout file to check if you are not squeezing the banner view when the device is in landscape (You could also post your layout file here if you're not sure). Secondly, most mediation networks do not support smart banners so I would contact the mediation network for solutions.

Thanks,
Elton

Chris

unread,
Jun 11, 2015, 5:45:13 PM6/11/15
to google-adm...@googlegroups.com, sopt...@gmail.com
First I am adding a layout programmatically then I set the height to this layout using adSize.getHeightInPixels() (SMART_BANNER). If I use only wrap_content for height then the layout will fill the entire screen (Because I add the layout programmatically.) At last I add the adView. Since the layout is fixed height then any banner (from mediation) larger than the SMART_BANNER height will be cut.
I am trying to find the best way to make this work without any problems.
I noticed that if I don't add the parent layout programmatically then I still have to set a fixed height to the layout because when the banner inside from the mediation is larger then, it will overlap my content instead of pushing it. Now I find that the best way is to set the height of the layout using the height of the mediation banners since I use only CustomEvents, this way the content will be pushed whenever a banner is taller. Is this what admob recommends? 
In short way the options that i have are: banner cut, banner overlaps some of my content , banner push my content, or maybe layout set a maximum possible height and use only part of it, the rest is unused. (so if a network gives a 90dp banner and another network gives a 50dp banner then I always use 90dp for layout height)

Another question is related to creating and destroying programmatically a parent layout. Is it okay to create and destroy the parent layout containing the adView or should I just use setVisibility to GONE. I need this because I am using also my own custom mediation.

Thank you for your help,
Chris

Elton Kent

unread,
Jun 12, 2015, 3:28:33 PM6/12/15
to google-adm...@googlegroups.com, sopt...@gmail.com
I see. Your approach to maintain the height should work. Have you considered using layout weight? That way your view is allotted a space regardless of the dimensions of other views. Like I've mentioned earlier, make sure the mediation network you are using supports smart banners.
Regarding destroying the AdView, you can call AdView.destroy() (only in the activity's onDestroy() method). If you plan to simply make it go away, you should use setVisibility(View.GONE). 

Cheers,
Elton

Chris

unread,
Jun 12, 2015, 7:23:19 PM6/12/15
to google-adm...@googlegroups.com, sopt...@gmail.com
Thank you for your recommendations, they are very valuable and will simplify allot my code. Using just setVisibility(View.GONE) will also no longer force me to programmatically create layouts.

My main layout is RelativeLayout so weight have no effect. I will test it also with LinearLayout and weight but I doubt that it will adjust my content when an ad from mediation shows and is taller.
I am not using mediation adapters at all, I know they are not supporting SMART_BANNER and they return NO_FILL all the time. This is one of the reasons I am making my own CustomEvents and this way I come with this height problem.

I like allot SMART_BANNER because it is full width but I think it will have been better if we can set the height (32dp 50dp 60dp or 90dp). One of the reason is that in some apps the content require more screen space and then we can use a little smart banner and in other apps the content does not require allot of space and we can use a taller smart banner (obviously taking in consideration the screen size).

Thank you for your time.
Chris

黄冬

unread,
Jan 9, 2018, 5:47:38 AM1/9/18
to Google Mobile Ads SDK Developers
Hello Elton:
         I have the problem with Chris. I am using the custom event to mediate other ad network. I am working on the banner, and the banner are cut to half. And I have tried many ways to fix it, including the way you mentioned in this post, however banner is still showing half. Do you have any solutions for it?
         Thank you.
Message has been deleted

Bharani Cherukuri (Mobile Ads SDK Team)

unread,
Jan 9, 2018, 10:20:38 AM1/9/18
to Google Mobile Ads SDK Developers
Hello, 

I see that you created a new thread regarding the same issue. Let's continue our discussion from there. 

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

On Sunday, June 7, 2015 at 9:56:26 AM UTC-4, Chris wrote:

黄冬

unread,
Jan 9, 2018, 9:33:58 PM1/9/18
to Google Mobile Ads SDK Developers
OK. Thank you.
Reply all
Reply to author
Forward
0 new messages