Skip to content
Francisco Dias edited this page Mar 26, 2026 · 2 revisions

Declared Age Range Extension

Welcome to the Declared Age Range extension wiki!

Declared Age Range is a GameMaker extension that wraps Apple's DeclaredAgeRange framework on iOS.

The extension presents the system age range sheet and returns an age range result describing the user's declared age bracket, along with the declaration method reported by the platform.

This is useful for:

  • Presenting an Apple-provided age range request flow
  • Adapting content to broad age brackets instead of exact age
  • Supporting parental or guardian declaration flows when available
  • Keeping age checks inside the native platform experience

Notes

  • This extension is only supported on iOS 26.2 and newer.

  • declared_age_range_is_supported can be used to check whether the current device and OS version support the API.

  • declared_age_range_request is asynchronous and always returns its result through the callback.

  • age_gate_1 is required and must be greater than or equal to 0.

  • age_gate_2 and age_gate_3 are optional. Pass -1 for either value to omit that age gate.

Basic example of usage:

if (declared_age_range_is_supported())
{
    declared_age_range_request(13, 16, 18, function(result)
    {
        if (!result.success)
        {
            show_debug_message("DeclaredAgeRange failed: " + result.error);
            return;
        }

        show_debug_message("Lower: " + string(result.age_lower));
        show_debug_message("Upper: " + string(result.age_upper));
        show_debug_message("Declaration: " + string(result.declaration));
    });
}
else
{
    show_debug_message("DeclaredAgeRange requires iOS 26.2+");
}

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.

Structs

This module offers a collection of structs, which serve as custom data models for organizing and structuring data. Explore the provided structs to better understand the relationships between data elements and simplify your data manipulation tasks.

Constants

This module includes a set of predefined constants that can be utilized for various purposes. Browse through the available constants to find values relevant to your needs and enhance the efficiency of your code.



Back To Top

declared_age_range_is_supported

Returns whether the Declared Age Range API is supported on the current device. This currently requires iOS 26.2 or newer.


Syntax:

declared_age_range_is_supported()



Returns:

Boolean


Example:

if (declared_age_range_is_supported())
{
    show_debug_message("DeclaredAgeRange is available");
}
else
{
    show_debug_message("DeclaredAgeRange is not available on this device");
}



Back To Top

declared_age_range_request

Requests the user's age range using up to 3 age thresholds.

Important

This API may present Apple-controlled UI to the user.

System UI

  • Call from a valid UI flow
  • Do NOT call during startup splash
  • Do NOT call while backgrounded
  • Avoid unstable transitions

Warning

Do not repeatedly call this function.

Repeated Calls

  • Do NOT call every frame
  • Do NOT call in Step events
  • Cache results when possible

Caution

Age range data is privacy-sensitive.

Privacy

  • Do not store unnecessarily
  • Do not transmit unnecessarily
  • Follow store policies and regulations

Note

The request may fail even when supported.

Possible reasons:

  • User declined sharing
  • Guardian declined sharing
  • No valid UI context
  • System/runtime error

Always inspect result.error.


This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

declared_age_range_request(age_gate_1, age_gate_2, age_gate_3, callback)
Argument Type Description
age_gate_1 Real The primary age threshold (must be >= 0). Defines the minimum boundary for age segmentation.
age_gate_2 Real Secondary threshold used to further divide the age range. Must be greater than or equal to age_gate_1, or -1 to omit.
age_gate_3 Real Tertiary threshold for additional segmentation. Must be greater than or equal to age_gate_2 (if provided), or -1 to omit.
callback Function Receives DeclaredAgeRangeResult



Returns:

N/A


Triggers:

Callback

Key Type Description
result DeclaredAgeRangeResult

Example:

declared_age_range_request(13, 16, 18, function(result)
{
    if (!result.success)
    {
        if (result.error != "")
        {
            show_debug_message("DeclaredAgeRange error: " + result.error);
        }
        else
        {
            show_debug_message("User declined to share an age range");
        }
        return;
    }

    show_debug_message("Age lower: " + string(result.age_lower));
    show_debug_message("Age upper: " + string(result.age_upper));

    switch (result.declaration)
    {
        case DeclaredAgeRangeDeclaration.SelfDeclared:
            show_debug_message("Age range was self declared");
        break;

        case DeclaredAgeRangeDeclaration.GuardianDeclared:
            show_debug_message("Age range was guardian declared");
        break;

        default:
            show_debug_message("Declaration type: " + string(result.declaration));
        break;
    }
});

/// Example result (success):
{
    success: true,
    age_lower: 13,
    age_upper: 15,
    declaration: DeclaredAgeRangeDeclaration.SelfDeclared,
    error: ""
}

/// Example result (failure - unsupported OS):
{
    success: false,
    age_lower: -1,
    age_upper: -1,
    declaration: DeclaredAgeRangeDeclaration.Unknown,
    error: "DeclaredAgeRange requires iOS 26.2+."
}



Back To Top

DeclaredAgeRangeDeclaration

Describes how the reported age range was declared or checked.

These constants are referenced by the following structs:


Member Description
Unknown No declaration information is available.
SelfDeclared The age range was declared by the user.
GuardianDeclared The age range was declared by a guardian.
CheckedByOtherMethod The age range was checked by another method.
GuardianCheckedByOtherMethod The age range was guardian-checked by another method.
GovernmentIDChecked The age range was checked using government ID.
GuardianGovernmentIDChecked The age range was guardian-checked using government ID.
PaymentChecked The age range was checked using a payment method.
GuardianPaymentChecked The age range was guardian-checked using a payment method.


Back To Top

DeclaredAgeRangeResult

Represents the result of a declared age range request.

Note

The API returns an age range, not an exact age.

Example:

  • age_lower = 13
  • age_upper = 17

This means the user is within that range.


Important

success == false does NOT always mean an error.

It may indicate:

  • User declined sharing
  • Guardian declined sharing
  • Unsupported device
  • Runtime/UI issue

Tip

Use declaration to estimate trust level in your logic.

Suggested interpretation:

Lower trust:

  • SelfDeclared
  • GuardianDeclared

Medium:

  • CheckedByOtherMethod
  • GuardianCheckedByOtherMethod

Higher:

  • GovernmentIDChecked
  • GuardianGovernmentIDChecked
  • PaymentChecked
  • GuardianPaymentChecked

This struct is referenced by the following functions:


Member Type Description
success Boolean True if request succeeded
age_lower Real Lower bound (-1 if unavailable)
age_upper Real Upper bound (-1 if unavailable)
declaration DeclaredAgeRangeDeclaration Verification method
error String Error message if failed