ageRange.requestAgeRange()

Type Library Return value Revision Keywords See also Function plugin.ageRange.* none Release 2025.3721 age range, age verification, parental controls, Screen Time, iOS 18 plugin.ageRange.init()
ageRange

Overview

Requests the user’s age range with custom age gates. The user will be prompted to share their age range through the iOS Screen Time system. Results are returned through the listener function set in plugin.ageRange.init().

This feature requires iOS 26.0 or later.

Syntax

plugin.ageRange.requestAgeRange( )

Example

local ageRange = require( "plugin.ageRange" )

local function ageRangeListener( event )
    if event.isError then
        print( "Error:", event.errorMessage )
    elseif not event.isAvailable then
        print( "Age range not available" )
    elseif event.declined then
        print( "User declined to share age range" )
    else
        print( "Lower bound:", event.lowerBound )
        print( "Upper bound:", event.upperBound )
        print( "User status:", event.userStatus )
        
        -- Check user status
        if event.userStatus == "verified" then
            print( "User is a verified adult (18+)" )
        elseif event.userStatus == "supervised" then
            print( "User has parental controls active" )
        end
    end
end

-- Initialize the plugin
ageRange.init( ageRangeListener )

-- Request age range with custom gates
ageRange.requestAgeRange( )