Closed rotter closed 1 year ago
As a workaround (if someone else has the same issue), I am loading SmartBanner size when in Landscape mode, and Adaptive when in Portrait
AdSize currentBannerSize = AdSize.SmartBanner;
if (is_portrait_orientation)
{
currentBannerSize = ... (same code as in the sample docs)
}
This is interesting, since when I tested landscape itself it worked fine. Have you tried testing launching in landscape? I have a feeling it may be related to the timing of the request - ie the SDK thinks that the system is in portrait but unity thinks it's in landscape. Are you using the currentOrientation API or the landscape API?
I use neither (Im not really sure what those APIs are). It was a long time ago I implemented that part and instead of checking for events/etc I noticed I could just check for the Screen.width/height, and when width > height Im on Landscape, else Im on Portrait. But I dont think it makes any difference, does it?
Now regarding launch that makes some sense (if that portrait/landscape check is cached on Admob side). I ALWAYS launch the game on Portrait mode, then only after launching I enable rotation, depending on the player preferences (he may have locked the rotation on the game for Portrait-only, or Landscape-only, or free-rotation).
EDIT: but note that Banner is only built much later, only when the match starts, so when I build the banner Im already on Landscape mode (on free rotation).
EDIT2: note that SmartBanner or regular banner works fine, so the landscape/portrait detection is working normally on those banners
Ok, I've determined what this is, it's because (not sure if on all devices) the Unity screen width is larger than the Android screen width, and then the SDK thinks that you're requesting an ad wider than the screen and the request fails.
Are you seeing this on iOS or only Android? Also which devices?
Hi,
Landscape adaptive banners doesn't work on all devices. I'm not sure, but Unity normally returns an equal or smaller Screen.Width. Not a larger width.
At the mobiles returning the "Invalid Request" error; When providing a slightly smaller width, it does show a banner, but not stretched out and the height is too large. In other words, seems it doesn't adapt at all but a regular 320x50 box or so.
Adative Works on; Samsung Galaxy Grand Prime (Android 5.1.1). (Unity's Screen.Width equal to Device hardware width / Camera.main.systemWidth).
Adaptive banner doesn't work on; Samsung Galaxy S10+ (Unity's Screen.Width smaller than reported device width (based on the resolution set)
Huawei Y6 (Android 8.0) (Unity's Screen.Width equal to device width / Camera.main.systemWidth)
Regards.
Hi,
Further testing; LG G4 (Android 6.0.1) and Samsung S7 (Android 8); both get an adaptive landscape banner, but shows it the same way as SmartBanners (not stretched, lot of black around a default, text banner).
Out of 10 different devices; 50% works as it should, the other half doesn't.
regards.
Hi. Any updates?
I have determined that our SDK is getting a different max screen width from Unity which is why the ad request is determined as invalid. We haven't determined why the screen width we're getting is not the full screen width. The SDK is using DisplayMetrics screen width. So the investigation is ongoing.
In the meantime, if you want the banner to load, you can use the display metrics width (divided by density) in Android, for example as per this post.
Its also not working on Samsung S8 device.
I published a solution for this, use AdSize.FullWidth
for the width parameter, see the updated docs. You should use the latest release.
Yes, I have used it & it fixed my issue to some extent. The problem now is that I cannot resize it so that it will be good fit for all resolution.
On Thu, Jan 9, 2020 at 11:35 PM Samuel Stow notifications@github.com wrote:
I published a solution for this, use AdSize.FullWidth for the width parameter, see the updated docs https://developers.google.com/admob/unity/banner/adaptive. You should use the latest release https://github.com/googleads/googleads-mobile-unity/releases/latest.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/1068?email_source=notifications&email_token=ALX3CEZAKEBP5SGI5AK3ZF3Q45VA7A5CNFSM4JKMJHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRJ2LA#issuecomment-572693804, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALX3CEZF7BSHOL5OSKFN3RDQ45VA7ANCNFSM4JKMJHNQ .
Can you clarify what you mean by that? What is an example of it not being a good fit for a given resolution? Can you include a screenshot?
On Thu, Jan 9, 2020 at 11:36 PM umairh2018 notifications@github.com wrote:
Yes, I have used it & it fixed my issue to some extent. The problem now is that I cannot resize it s that it will be good fit for all resolution.
On Thu, Jan 9, 2020 at 11:35 PM Samuel Stow notifications@github.com wrote:
I published a solution for this, use AdSize.FullWidth for the width parameter, see the updated docs https://developers.google.com/admob/unity/banner/adaptive. You should use the latest release https://github.com/googleads/googleads-mobile-unity/releases/latest.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/googleads/googleads-mobile-unity/issues/1068?email_source=notifications&email_token=ALX3CEZAKEBP5SGI5AK3ZF3Q45VA7A5CNFSM4JKMJHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRJ2LA#issuecomment-572693804 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALX3CEZF7BSHOL5OSKFN3RDQ45VA7ANCNFSM4JKMJHNQ
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/1068?email_source=notifications&email_token=ABNGOFBTAZ6QF2QYIXLWYEDQ5AQPXA5CNFSM4JKMJHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIS6ZYY#issuecomment-572910819, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNGOFGSE7BV3HVUBW7ACITQ5AQPXANCNFSM4JKMJHNQ .
It neither covering the whole screen neither covering a half screen, Its very weird to look on adaptive ad
covering 75% of space at bottom of screen width
Here is the image i am uploading:
@umairh2018 - what device are you testing on? Are you using AdPosition.Bottom
?
Samsung s8. Yes i am using it on bottom
On Fri, 17 Jan 2020, 8:13 pm Samuel Stow, notifications@github.com wrote:
@umairh2018 https://github.com/umairh2018 - what device are you testing on? Are you using AdPosition.Bottom?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-mobile-unity/issues/1068?email_source=notifications&email_token=ALX3CE2IUNMODVOYI5DRKZTQ6HDJ5A5CNFSM4JKMJHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJH7OII#issuecomment-575665953, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALX3CEYWT4SITF3CU5UP7ELQ6HDJ5ANCNFSM4JKMJHNQ .
Let me know if this needs to be in it's own issue. But since it's related to Adaptive Banners in Landscape...
The situation is as follows. I have a Canvas with Canvas Scaler set to scale with screen width. Reference resolution 1920x1080. Set to match Width (Match slider to 0f).
Adaptive Banners work fine on my tablet with resolution 1920x1200. But on my phone with resolution 2159x1080 it doesn't:
When requesting a fullsize ad (via AdSize.GetLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth)
). I indeed get a banner filling almost the full width of the screen. But with a height of 236. (Which is way too big. Almost 22% instead of the max 15% height, So should be 162 max.).
As measured from a screenshot and as reported by bannerview.GetHeightInPixels()
. And GetWidthInPixels()
reporting 2031 (likely/partially because of the safe area).
In other words, somehow a screen height of ~1574 is being reported.
To fix this it seemed likely to request a banner with AdSize.GetLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(1920)
.
But I end up not receiving any ads.
Probably to do with the reported bannerview.GetWidthInPixels() being 5040.
And logcat reporting: "Ad size will not fit on screen"
All this was tested / reproduced using the sample HelloWorld project (with the necessary adjustments of course).
EDIT: Discovered something else. When having the device already in Landscape when starting up the app. The correct size is being requested / shown (162 pixels height). When you startup holding it in Portrait (and turning it only later to Landscape). The issue appears: Getting too high/tall banners (236).
(The other issue, when requesting width 1920, exists in either case)
See also. Replied privately as was requested. Yet to hear back.
someone else use:
return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, AdSize.FULL_WIDTH);
it doesn't calculate the round corners of the mobile this way.
but if you used :
return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(this, adWidth);
it add the round corners size to the width so you will get always error in showing adaptive banner
i think google ads have to update the documentation or the way AdSize get the width based on mobiles round corners problem. it took me 3 days debugging.
I am trying to migrate to Adaptive banner, on a game that is Portrait it worked fine.
Now I am trying to make it work on a game that has rotation, but the banner wont load when in Landscape orientation. When it's on Portrait orientation it works fine.
The error I get isnt very descriptive: I get an "Invalid request" on AdFailedToLoadEventArgs.Message
Any ideas?