The following sections show you how to load and then show and hide an MREC.
Loading an MREC
To load an MREC, call createMRec()
, passing in your Ad Unit ID and desired adview position:
var mrecAdUnitId:String = "ad_unit_ID"; public function initializeMRecAds():void { // MRECs are sized to 300×250 on phones and tablets AppLovinMAX.createMRec(mrecAdUnitId, AdViewPosition.CENTERED); }
The above example creates an MREC centered on the display (CENTERED
). The complete list of position options are:
TOP_LEFT
TOP_CENTER
TOP_RIGHT
CENTER_LEFT
CENTERED
CENTER_RIGHT
BOTTOM_LEFT
BOTTOM_CENTER
BOTTOM_RIGHT
Hiding and Showing an MREC
To hide an MREC ad, call hideMRec()
:
AppLovinMAX.hideMRec(mrecAdUnitId);
To show an MREC ad, call showMRec()
:
AppLovinMAX.showMRec(mrecAdUnitId);