message  Send Feedback

MobileAd

Base class for InterstitialAd, RewardedAd, NativeAd and BannerAd.

Properties

Methods


Properties

adUnitId

adUnitId: string;

The Ad Unit ID for this AdMob ad.


loaded

loaded: boolean;

Whether the advert is loaded and can be shown.


Methods

load

load(): void;

Start loading the advert with the provided RequestOptions.

It is recommended you setup ad event handlers before calling this method.


onAdEvent

onAdEvent(
  listener: AdEventListener
): Function;

Listen to ad events. See AdEventTypes for more information.

Returns an unsubscriber function to stop listening to further events.

Example

// Create InterstitialAd/RewardedAd
const advert = InterstitialAd.createForAdRequest('...');
const unsubscribe = advert.onAdEvent((type) => {
});
// Sometime later...
unsubscribe();

Parameters

  • listener: AdEventListener
    A listener callback containing a event type, error and data.

show

show(
  showOptions?: AdShowOptions
): Promise<void>;

Show the loaded advert to the user.

Example

// Create InterstitialAd/RewardedAd
const advert = InterstitialAd.createForAdRequest('...');
advert.onAdEvent((type) => {
if (type === AdEventType.LOADED) {
advert.show({
immersiveModeEnabled: true,
});
}
});

Parameters

  • showOptions: (optional) AdShowOptions
    An optional `AdShowOptions` interface.

React Native Market

Looking for pre-built React Native apps to kick start your next project? Check out the React Native Market by Invertase.

Your purchases help support our open-source projects such as React Native Firebase. All items are currently 50% off to celebrate the release of React Native Firebase version 6.
shopping_cartVisit React Native Market