Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Request: for AdSize , offer a way to detect what's expected to be returned for a given width&height restriction

25 views
Skip to first unread message

Liran Barsisa

unread,
Feb 4, 2025, 4:52:57 AMFeb 4
to Google Mobile Ads SDK Developers
When I use AdSize.getInlineAdaptiveBannerAdSize for various sizes, I often don't get an ad at all for them.

When I use the arguments of 411x249 dp, I actually get a much smaller AdView in height, too, about 1/4 of the height I've provided.
However, when I use the arguments of 411x250 dp (just one dp larger), I get an ad that takes the full height and most of the width.

Is there any way to know if such a thing is possible, that given some dimensions of restricting the banner ad, I'm expected not to get an ad at all, and even if I am expected to get one, what's the size of it that's going to be?

Maybe I could at least rely on one of the fixed sizes that might be returned?
Would it always return one of the fixed sizes, or any size might be returned?

Mobile Ads SDK Forum Advisor

unread,
Feb 4, 2025, 8:57:55 AMFeb 4
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi Liran,

Thank you for contacting the Mobile Ads SDK support team.

  • Is there any way to know if such a thing is possible, that given some dimensions of restricting the banner ad, I'm expected not to get an ad at all, and even if I am expected to get one, what's the size of it that's going to be?
    • There is no such thing that given some dimensions of restricting the banner ad, you are not getting an ad at all.  The size of the container in which you place your ad must be at least as big as the banner. Any padding effectively decreases the size of your container. If the container cannot fit the banner ad, the ad isn't shown and the following warning is logged:
      • W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 288x495 dp.
    • You can get the Adsize using fun getAdSize() for the received Ad.
  • Maybe I could at least rely on one of the fixed sizes that might be returned?
    • Yes you can rely on one of the fixed sizes. This would return one of the fixed sizes only. 
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vH00P:ref" (ADR-00286964)

Thanks,
 
Google Logo Mobile Ads SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



Liran Barsisa

unread,
Feb 4, 2025, 9:06:42 AMFeb 4
to Google Mobile Ads SDK Developers
I don't understand your answer.
I'm talking about before I try to load the ad, because when I try to load the ad, it's too late as it takes time to reach the server and then tell me I don't get an ad from what I've provided.
Calling  getAdSize() doesn't make sense, because the function I talked about is AdSize.getInlineAdaptiveBannerAdSize  , which given the dimensions of the View that will contain the ad, should prepare me already AdSize instance. 
I want to know if there is a way to detect what will happen with it, before starting to load the ad, to avoid useless loading as it will probably always fail.

As for relying on the fixed sizes, what I meant is that if the dimensions are at least as large as one of them (and maybe I can add another restriction, such as 75% of the area taken), I can assume that it will most probably get me an ad , and not fail because of dimensions that no ad supports.

I hope it's clear now what I'm asking about.
Reply all
Reply to author
Forward
0 new messages