> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-fairbid/fairbid-sdk/ad-formats/medium-rectangle-ads.md).

# Medium Rectangle Ads

Medium Rectangle (MREC) ads are 300x250 sized ads, serving both static and video, and positioned within editorial content of the app. There is no close button on MREC ads, and they are not skippable. Similar to Banner ads, MREC ads are refreshed according to a set refresh rate of between 10-120 seconds.

{% hint style="info" %}
MREC Ads are available from FairBid SDK version 3.33.1.
{% endhint %}

### Showing an MREC

Implement the code below to show an MREC:

{% tabs %}
{% tab title="Android" %}
{% code title="Kotlin" %}

```kotlin
fun showBanner() {
    val bannerOptions = BannerOptions().withSize(BannerSize.MREC)
            // if you don't specify your container view,
            // we'll display it at the bottom of the screen
            .placeInContainer(YOUR_CONTAINER_VIEW_GOES_HERE)
    Banner.show("placementId", bannerOptions, activity)
}
```

{% endcode %}

{% code title="Java" %}

```java
private void showBanner() {
    BannerOptions bannerOptions = new BannerOptions().withSize(BannerSize.MREC)
        // if you don't specify your container view,
        // we'll display it at the bottom of the screen
        .placeInContainer(YOUR_CONTAINER_VIEW_GOES_HERE);
    Banner.show("placementId", bannerOptions, activity);
}
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
Implement the code below to request an MREC:

{% code title="Swift" %}

```swift
 FYBBanner.delegate = MyBannerDelegate()
    let bannerOptions = FYBBannerOptions(placementId: "1234", size: .MREC)
    FYBBanner.request(with: options)
```

{% endcode %}

{% code title="Objective-C" %}

```objective-c
#import <FairBidSDK/FairBid.h>

      FYBBanner.delegate = [[MyBannerDelegate alloc] init];
      NSString *placementId = @"1234";
      FYBBannerOptions *bannerOptions = [[FYBBannerOptions alloc] initWithPlacementId:@"1234" size:FYBBannerSizeMREC];
      [FYBBanner requestWithOptions:bannerOptions];
```

{% endcode %}

To show an MREC ad, display the view received in the `bannerDidLoad:impressionData:` that’s part of `FYBBannerDelegate` protocol.

{% code title="Swift" %}

```swift
extension MyViewController: FYBBannerDelegate {

    func bannerDidLoad(_ banner: FYBBannerAdView, impressionData: FYBImpressionData)
    {
      // set up the MREC banner constraints
       myView.addSubview(banner)
       banner.center = CGPoint(x: myView.frame.width / 2, y: myView.center.y)
    }

    …
}
```

{% endcode %}

{% code title="Objective-C" %}

```objective-c
// in implementation of FYBBannerDelegate protocol

- (void)bannerDidLoad:(FYBBannerAdView *)banner impressionData:(FYBImpressionData *)impressionData {
    [self.myView addSubview:banner];
    banner.center = CGPointMake(self.myView.bounds.size.width / 2, self.bounds.size.height / 2);
}
```

{% endcode %}
{% endtab %}

{% tab title="Unity" %}
This feature is not available on Unity.
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digitalturbine.com/dt-fairbid/fairbid-sdk/ad-formats/medium-rectangle-ads.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
