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);
}
- Module:
ageVerification- Install eitri-ios-age-verification or eitri-android-age-verification
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);
}
Generated using TypeDoc
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.