# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
