Medium Rectangle Banner Ads
This guide explains how to integrate medium rectangle banner ads into a Construct app.
Medium Rectangle (MREC) are rectangular image or text ads that occupy a spot with size in dp (300x250) on screen. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time.
Load MREC ad
Loads an MREC ad. This action works asynchronously, and you can use the Wait for previous actions to complete action to wait until the ad has been loaded or failed to load.
When autoload is enabled, a new ad will be automatically loaded after each display, and loading failures will trigger automatic retry attempts.
Ad content may take some time to load after creating an ad instance. To ensure the ad displays instantly when needed, load the ad instance in advance.
Conditions
- On MREC Ad Loaded: Triggered when an MREC ad is successfully loaded.
- On MREC Ad Failed to Load: Triggered when an MREC ad fails to load.
- On MREC Ad Clicked: Triggered when an MREC ad is clicked.
- Is MREC Ad Loaded: Checks if an MREC ad is loaded.
Show MREC ad
The banner will not be visible until show action is performed. The show function has a position parameter that specifies where the banner ad should be placed.
To change the banner’s position on the screen, simply perform the show action again with the new parameters.
The banner's activity can be changed even if it is not ready to be shown yet. When the ad becomes ready, it will be shown automatically if autoload/show logic requires it.
Ad Position
The X offset and Y offset properties allow you to adjust the banner’s position relative to the specified anchor position, in DP. CAS will not allow an ad to be placed outside the screen or overlap with screen cutouts. Leave 0 to not use offset.
Some anchor positions do not support offset on the X or Y axis, this can be seen in the table as (X, Y).
| Left | Center | Right | |
|---|---|---|---|
| Top | TL(X, Y) | TC(Y) | TR(X, Y) |
| Middle | ML(X) | MC(-) | MR(X) |
| Bottom | BL(X, Y) | BC(Y) | BR(X, Y) |
The coordinates on the screen are determined in Density-independent Pixels(DP).