There is a questions related to the Google Ad representation and ads sizes
The problem is - is there a way to retrieve the ad with size of 728*90
and set it to my view which is 600*90
?
The problem is that the Ad is truncated in the portrait mode while in the landscape it looks good.
I use tablet and in order to represent the Ad I use AdManagerAdView
.
I found out where the problem is - the problem is that the app requests the ad with the size of (w:) 728 * (h:) 90
, however, the width of the tablet is 600dp
, so it is obvious that 128dp
is kind of out of the screen.
I tried to check all possible ad sizes described here - https://developers.google.com/ad-manager/mobile-ads-sdk/android/banner#banner_sizes
these sizes:
this.setAdSizes(AdSize(320, 50)) + this.setAdSizes(AdSize(320, 100)) this.setAdSizes(AdSize(300, 250)) + this.setAdSizes(AdSize(468, 60)) this.setAdSizes(AdSize(728, 90)) +
However, I wasn't able to retrieve all the ads by thier sizes, I only got these:
this.setAdSizes(AdSize(320, 50)) + this.setAdSizes(AdSize(300, 250)) + this.setAdSizes(AdSize(728, 90)) +
From this point I made a conclusion that a publisher provides only these specific ads sizes. For me it means that if it is nessasary to use smaler ad that 728*90
the next size would be 300*250
which is more than twice narrowed than I need (600dp
).
So the next idea was to use NativeAd
(https://developers.google.com/ad-manager/mobile-ads-sdk/android/native/start), however, I get an error:
onAdFailedToLoad: { "Code": 3, "Message": "No ad config.", "Domain": "com.google.android.gms.ads", "Cause": "null", "Response Info": { "Response ID": "null", "Mediation Adapter Class Name": "", "Adapter Responses": [] } }
So as far as I undestand there is no way just to start to use NativeAd
, it should be configurated on the publisher end first (as far as I see), because once I tried to made a request with the same credentials (as for AdManagerAdView
), I get this config error, looks like NativeAd
config is not existing on the publisher end.
So, finally the question is - is there a way to retrieve the ad with size of 728*90
and set it to my view which is 600*90
?
Eventually, I didn't find the solution I was looking for, so I did it like this - if the width of the screen is more than 728 so the biggest banner will be presented, if the screen width is less than 728, but greater than 300, so appropriate banner will be presented. I believe there is no need for the code presentation as the idea is pretty clear.