Setting the size of the display area for an ad

When you create a Banner object, you can specify the size of the ads that you want your application to display. After your application sends an ad request, the Advertising Service mediation layer returns an ad that fits the size that you specified. The Advertising Service supports the following sizes of ads, in pixels:
  • 320 x 53: Banner.MMA_SIZE_EXTRA_EXTRA_LARGE (recommended for rich media ads)
  • 300 x 50: Banner.MMA_SIZE_EXTRA_LARGE
  • 216 x 36: Banner.MMA_SIZE_LARGE
  • 168 x 28: Banner.MMA_SIZE_MEDIUM
  • 120 x 20: Banner.MMA_SIZE_SMALL

You can set the size of the display area by invoking setMMASize() and specifying one of the constants in the Banner class. For example, you can invoke setMMASize(Banner.MMA_SIZE_LARGE) to direct the mediation layer to return ads that are 216 x 36 pixels in size. You can also invoke setMMASize(Banner.MMA_SIZE_AUTO) to permit the Banner object to resize itself automatically to match the size of the ad that the mediation layer returns. This is the default behavior if you do not set the size of the display area in the application code.

As a best practice, you should set the size of the display area in your application. This approach allows you to control the size of the ads that you receive, and arrange the Banner object appropriately on the screen. If you permit the Banner object to resize itself automatically, you should ensure that the layout of your screen can support each of the different sizes.


Was this information helpful? Send us your comments.