react-native-google-mobile-ads
    Preparing search index...

    Class AppOpenAd

    Hierarchy (View Summary)

    Index
    • Parameters

      • type: AdType
      • requestId: number
      • adUnitId: string
      • adLoadFunction: AdLoadFunction
      • adShowFunction: AdShowFunction
      • adDestroyFunction: AdDestroyFunction
      • requestOptions: RequestOptions

      Returns AppOpenAd

    • Parameters

      • event: {
            body: {
                data?:
                    | RewardedAdReward & { responseInfo?: ResponseInfo }
                    | AppEvent & { responseInfo?: ResponseInfo }
                    | PaidEvent & { responseInfo?: ResponseInfo }
                    | { responseInfo?: ResponseInfo };
                error?: {
                    code: string;
                    message: string;
                    phase?: "load" | "show";
                    reason?: string;
                    responseInfo?: ResponseInfo;
                    responseInfoJson?: string;
                };
                type: EventType;
            };
        }

      Returns void

    • Listen to ad events. See AdEventTypes for more information.

      Returns an unsubscriber function to stop listening to further events.

      // Create InterstitialAd/RewardedAd
      const advert = InterstitialAd.createForAdRequest('...');

      const unsubscribe = advert.addAdEventListener(AdEventType.LOADED, () => {

      });

      // Sometime later...
      unsubscribe();

      Type Parameters

      Parameters

      • type: T

        The event type, e.g. AdEventType.LOADED.

      • listener: AdEventListener<T>

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

      Returns () => void

    • Listen to ad events. See AdEventTypes for more information.

      Returns an unsubscriber function to stop listening to further events.

      // Create InterstitialAd/RewardedAd
      const advert = InterstitialAd.createForAdRequest('...');

      const unsubscribe = advert.addAdEventsListener(({ type, payload }) => {
      });

      // Sometime later...
      unsubscribe();

      Type Parameters

      Parameters

      • listener: AdEventsListener<T>

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

      Returns () => void

    • Show the loaded advert to the user.

      Uses two error channels:

      • Rejects the returned promise when the show did not happen: the ad has not loaded, a show is already in flight, or the platform declines. Handle these with .catch() (or try { await } catch).
      • Throws synchronously for programmer errors: the ad has been destroyed, or showOptions are structurally invalid (checked only on a loaded ad with no show in flight, so otherwise the rejection comes first). Fix the call site.

      The fullscreen hooks' show absorbs both channels.

      // Create InterstitialAd/RewardedAd
      const advert = InterstitialAd.createForAdRequest('...');

      advert.addAdEventListener(AdEventType.LOADED, () => {
      advert
      .show({
      immersiveModeEnabled: true,
      })
      .catch(console.warn);
      });

      Parameters

      • OptionalshowOptions: AdShowOptions

        An optional AdShowOptions interface.

      Returns Promise<void>

    _adDestroyFunction: AdDestroyFunction
    _adEventListenerId: number
    _adEventListenersMap: Map<EventType, Map<number, AdEventListener<EventType>>>
    _adEventsListenerId: number
    _adEventsListeners: Map<number, AdEventsListener<EventType>>
    _adLoadFunction: AdLoadFunction
    _adShowFunction: AdShowFunction
    _adUnitId: string
    _destroyed: boolean
    _isLoadCalled: boolean
    _loaded: boolean
    _nativeListener: EmitterSubscription
    _presenceMarked: boolean
    _requestId: number
    _requestOptions: RequestOptions
    _responseInfo: ResponseInfo | null
    _showRequested: boolean
    _type: AdType