Admob smart banner

Pfap

Member
I added smart banners to the admob extension and it wasn't showing up, but I'm getting this debug message:

"Moving banner: 2560,1080"



the code I'm using is below


My room size is 512x288

Any ideas on what's going on here? Or how I can solve it?



show_debug_message("Add banner");
//global.bottomRight = true;
GoogleMobileAds_AddBanner(global.bannerId, GoogleMobileAds_Smart_Banner);//GoogleMobileAds_Banner
//GoogleMobileAds_
// Position it at bottom right of screen
var bw = GoogleMobileAds_BannerGetWidth();
var bh = GoogleMobileAds_BannerGetHeight();
var px = display_get_width()-bw;//+bw should position it at the left??? NMT
var py = display_get_height()-bh;
GoogleMobileAds_MoveBanner(px, py);
show_debug_message("Moving banner: " + string(px) + "," + string(py));
//Moving banner: 2560,1080




When I switch back to the GoogleMobileAds_Banner constant it works fine, but still shows the same output in the debug. So it must be some other issue.
 
Last edited:

Pfap

Member
When I originally changed my extension I only updated the android side of it, so going in and adding a case 6 to the ios stuff worked.
Below is the code from the extension. The google website has separate constants for landscape and portrait, I grabbed landscape "kGADAdSizeSmartBannerLandscape"

GADAdSize bannerSize;
switch(type)
{
case 1: bannerSize = kGADAdSizeBanner; break;
case 2: bannerSize = kGADAdSizeMediumRectangle; break;
case 3: bannerSize = kGADAdSizeFullBanner; break;
case 4: bannerSize = kGADAdSizeLeaderboard; break;
case 5: bannerSize = kGADAdSizeSkyscraper; break;
case 6: bannerSize = kGADAdSizeSmartBannerLandscape; break;
default: NSLog(@"AddBanner illegal banner size type %d", type); return;
}
 

MattXPG

Member
This is super late but display_get_width() gives you the dimension for your computer monitor (Assuming you are using the "Test" platform). You need to be using room_width or possibly view_wport[0] depending on your camera situation. It also appears that your banner didn't load yet so it gave 0 value for banner height and width.
 
Top