If you need to adjust your UI based on the adaptive banner size, you can retrieve the width and height of the loaded ad, in dp. The following code demonstrates how to do this:
You may want to stop auto-refresh for an ad. You may want to do this, for instance, when you hide an ad or you want to manually refresh. Stop auto-refresh for a banner or MREC ad with the following code:
Start auto-refresh for a banner or MREC ad with the following code:
Banner and MREC ads are rectangular ad formats that occupy part of an app’s layout—often at the top or bottom of the screen or inline in scrollable content. They remain visible as users interact with the app, which allows uninterrupted gameplay or use, and can refresh automatically after a set period.
The following sections show you how to load, show, and hide a banner or MREC ad.
The following code shows you how to load a banner or MREC ad by using your Ad Unit ID, desired position, and (for banners) desired background color. MAX sizes the ad for you automatically:
To show a banner or MREC, make the following call:
To hide a banner or MREC, make the following call:
You can also render banners and MRECs directly in your DOM as native UI components, as in the following example:
As of React Native plugin version 7.0.0, you can preload ads for native UI components before you mount AdView.
When you mount AdView with the Ad Unit ID you preloaded, this constructs AdView with a preloaded native UI component.
This allows ads to display quickly.
React Native plugin version 8.1.0 updates this preloading feature to support multiple AdView instances.
The preloadNativeUIComponentAdView() method returns an AdViewId, which you can use to specify the preloaded ad when you mount an AdView.
You can specify the AdViewId when you mount an AdView:
When you unmount an AdView, this does not destroy the preloaded platform widget, but caches it so the next mount can reuse it.
To release its resources, you must manually destroy it when you no longer need it:
If you omit an AdViewId when you mount an AdView, the component dynamically loads an ad.
In such a case, when you unmount the AdView, this automatically destroys it and the next mount does not reuse it.
See the example app at the AppLovin-MAX-React-Native GitHub project for a complete working example.
Adaptive banners are responsive banners with heights that derive from the device type and the width of the banner.
Banners from ad networks that support adaptive banners are adaptive by default.
To disable adaptive banners, set the corresponding parameter to false as in the following examples:
[COMPONENT: AdView]
[COMPONENT: AdView]
[COMPONENT: AdView]
“Why mobile banners ads persist in a video and playable world” from AppLovin’s Blog.
Google bidding and Google AdMob, Google Ad Manager, Liftoff Monetize, Pangle, and Yandex support adaptive banners. MAX sizes banners from other networks in the non-adaptive way.
Google recommends that developers include a 50 px padding between the banner placement and the app content. This makes it less likely that users accidentally click the banner. Refer to Google’s “About Confirmed Click” policy for more information and best practices.