Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Native Ad Options

Bruno D'Luka edited this page Jan 18, 2021 · 3 revisions

Native ads allow you to make additional customizations using the NativeAdOptions object. This guide shows you how to use NativeAdOptions.

Setting options

Define NativeAdOptions in NativeAd:

NativeAd(
  ...,
  options: NativeAdOptions(
    ...
  ),
)

By default, each time options is changed, the ad will be reloaded. To disable this behavior, set reloadWhenOptionsChange to false.

Options

adChoichesPlacement

The AdChoices overlay is set to the top right corner by default. Apps can change which corner this overlay is rendered in by setting this property to one of the following:

  • ADCHOICES_TOP_LEFT
  • ADCHOICES_TOP_RIGHT
  • ADCHOICES_BOTTOM_RIGHT
  • ADCHOICES_BOTTOM_LEFT

mediaAspectRatio

This sets the aspect ratio for image or video to be returned for the native ad. Setting it to one of the following constants will cause only ads with media of the specified aspect ratio to be returned:

  • NATIVE_MEDIA_ASPECT_RATIO_LANDSCAPE
  • NATIVE_MEDIA_ASPECT_RATIO_PORTRAIT
  • NATIVE_MEDIA_ASPECT_RATIO_SQUARE
  • NATIVE_MEDIA_ASPECT_RATIO_ANY

If it is not set, ads with any aspect ratio will be returned.

Using with the controller

You can use NativeAdOptions in the load() method:

controller.load(
  options: NativeAdOptions(
    ...
  ),
);

Next: Custom mute this ad