Separate banner for phones and tablets

Dear community,

We are currently trying to implement ads in our game using the SDKBOX AdMob plugin, but we have come across an issue.

Depending on whether the app is running on a phone or on a tablet, the ad should have a different width and height. In the configuration file for the SDKBOX plugin we specified an adunit with a certain width and height for one of these two platforms. However, we are unable to change these values on runtime to adapt our banner size to the platform the app is running on.

We have tried specifying two separate banner adunits (one for phone, one for tablet). In this case the plugin only loads the first banner adunit that it reaches.

We have also tried using the autosizing parameters (width and height set to 0), this resulted in a banner that had the wrong height.

Has anyone ever dealt with this problem before? If so, do you have a way to fix this?

Thanks.

@yinjimmy can you help?

“We have tried specifying two separate banner adunits (one for phone, one for tablet). In this case the plugin only loads the first banner adunit that it reaches.”

Hey, if you are talking about trying to load few banners with using different ad ids it wouldn’t work (tried myself OR I did something wrong before). Seems you can use only use 1 ad ID for banner and 1 fullscreen (I guess admob policy?), but you can have multiply numbers of the same ad with different name and different sizes, but with the same ad id. Moreover you can only do cache->show->hide->cache->show.->hide…

P.S. I never saw in the admob header file that it allows to re-size banner in realtime, can someone explain to me how to achieve that? Since calculating available space for the ad and the selecting the right one from config is kind of a big hassle to do it.(Using VS2015)

You can set your sdkbox_config.json like this:

    "ios": {
        "AdMob": {
            "test": true,
            "ads": {
                "gameover": {
                    "type": "interstitial",
                    "id": "ca-app-pub-1329374026572143/4185543717"
                },
                "cellphone": {
                    "width": 300,
                    "type": "banner",
                    "id": "ca-app-pub-1329374026572143/3847466511",
                    "alignment": "bottom",
                    "height": 50
                },
                "tablet": {
                    "type": "banner",
                    "id": "ca-app-pub-1329374026572143/3847466511",
                    "alignment": "bottom",
                    "height": 100
                }
            }
        }
    }

Then cache the “tablet” for tablet device.
And I need to use smart banner when width=0, height=0.

// for phones
cache("cellphone");
// tablets
cache("tablet");