Notice for App Developers

To use these methods, the ageVerification module must be installed in the native app:

Overview

Provides the ability to retrieve the user's age range through the native age verification system on iOS and Android. This allows apps to implement age-based content restrictions or features without directly handling sensitive age data.

Hierarchy

  • AgeVerification

Methods

  • Retrieves the user's age range.

    Presents the platform's age sharing consent prompt when the user has not decided yet, and throws when the user is not sharing their age range β€” a declined consent is an error, not an empty result. Both platforms behave this way, so a single call covers iOS and Android.

    In that case the promise rejects with one of these codes, the same string on both platforms:

    • Eitri.AgeVerification.age.signals.not.shared: the user is not sharing their age range.
    • Eitri.AgeVerification.age.signals.verification.required: 🚨 Android only β€” the user is in a region where age sharing is mandatory, but Play does not know their age yet. Ask the user to open the Play Store, where they can verify their age or set up parental supervision.
    • 🚨 iOS: Native age verification only available on iOS 26+.

    • 🚨 Android: Native age verification only available on Android SDK 23+, and additionally requires a Play Store that supports age signals.

    Not every platform reports every field of AgeRangeOutput β€” see the interface for which.

    Example:

    let userIsAdult = false;
    try {
    const modules = await Eitri.modules()
    if (!modules.ageVerification) {
    // ageVerification module is unavailable
    return
    }

    const ageRange = await modules.ageVerification.getUserAgeRange();
    userIsAdult = (ageRange?.lowerBound ?? 0) >= 18;
    } catch (error) {
    console.log("getUserAgeRange.error: ", error);
    }

    Compatibility Control

    Returns Promise<AgeRangeOutput>

  • Returns whether associated laws or regulations may apply to your app based on the person’s location and account settings.

    Android will throw an error, as there is no native methods to determine this on Android.

    • 🚨 iOS: Native age verification only available on iOS 26.2+.
    try {
    const modules = await Eitri.modules()
    if (!modules.ageVerification) {
    // ageVerification module is unavailable
    return
    }

    let userIsAdult = false;
    const isSubjectToAgeRegulations = await modules.ageVerification.isSubjectToAgeRegulations();
    if (isSubjectToAgeRegulations) {
    userIsAdult = (await modules.ageVerification.getUserAgeRange())?.lowerBound >= 18;
    }
    if (userIsAdult) {
    // show age restricted content
    }
    } catch (error) {
    console.log("isSubjectToAgeRegulations.error: ", error);
    }

    Returns Promise<boolean>

Generated using TypeDoc