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

    Interface AdsConsentInterface

    interface AdsConsentInterface {
        gatherConsent(options?: AdsConsentInfoOptions): Promise<AdsConsentInfo>;
        getConsentInfo(): Promise<AdsConsentInfo>;
        getGdprApplies(): Promise<boolean>;
        getPurposeConsents(): Promise<string>;
        getPurposeLegitimateInterests(): Promise<string>;
        getTCModel(): Promise<TCModel>;
        getTCString(): Promise<string>;
        getUserChoices(): Promise<AdsConsentUserChoices>;
        loadAndShowConsentFormIfRequired(): Promise<AdsConsentInfo>;
        requestInfoUpdate(options?: AdsConsentInfoOptions): Promise<AdsConsentInfo>;
        reset(): void;
        showForm(): Promise<AdsConsentInfo>;
        showPrivacyOptionsForm(): Promise<AdsConsentInfo>;
    }
    Index
    • Returns the TC Model of the saved IAB TCF 2.0 String.

      import { AdsConsent } from '@invertase/react-native-google-ads';

      const tcModel = await AdsConsent.getTCModel();

      Returns Promise<TCModel>

    • Requests user consent information.

      The response from this method provides information about consent form availability and consent status.

      import { AdsConsent } from 'react-native-google-mobile-ads';

      const consentInfo = await AdsConsent.requestInfoUpdate();
      console.log('A consent form is available:', consentInfo.isConsentFormAvailable);
      console.log('User consent status:', consentInfo.status);

      Parameters

      Returns Promise<AdsConsentInfo>

    • Shows a Google-rendered user consent form.

      import { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';

      async function requestConsent() {
      const consentInfo = await AdsConsent.requestInfoUpdate();

      // Check if user requires consent
      if (
      consentInfo.isConsentFormAvailable &&
      (consentInfo.status === AdsConsentStatus.UNKNOWN ||
      consentInfo.status === AdsConsentStatus.REQUIRED)) {
      // Show a Google-rendered form
      const formResult = await AdsConsent.showForm();

      console.log('User consent obtained: ', formResult.status === AdsConsentStatus.OBTAINED);
      }
      }

      Returns Promise<AdsConsentInfo>