Check a user’s age range and supervision status with platform age signals, and gate content or purchases for minors in your app.
Beta API noticeThe underlying platform APIs are currently in beta. During the beta period, Play Age Signals may return API_NOT_AVAILABLE or throw exceptions on some devices. Always handle these cases gracefully and provide conservative fallbacks for age-gated flows.
AgeSafety exposes system-provided age signals and supervision state so you can determine whether a user is a minor, whether their account is supervised (Family Link / Screen Time), and whether parental approval is required for significant app changes or feature enablement.The plugin intentionally passes through platform signals (it does not collect or send identifiable data itself). Use the plugin to gate UI, require parental confirmation, or disable features for underage users.
Why use AgeSafety?
Compliance made simple: Meet platform requirements for age-appropriate content
User safety first: Protect minors with proper age verification
Parental controls: Respect existing family supervision settings
Unified approach: One API works across both Android and iOS platforms
Key terms
The following terms will help you implement AgeSafety:Age bounds: Platforms return age ranges (like 13–17) rather than exact ages. Both bounds are inclusive, meaning a user with bounds 13–17 could be 13, 17, or anywhere in between.Strong verification: High-confidence signals from payment verification or government ID checks.Weak verification: Self-declared ages or other lower-confidence methods.Supervised account: The user’s device or account is under parental supervision (Family Link on Android, Screen Time on iOS).Supervisor approval required: The platform indicates that significant app changes need parent/guardian approval.
Privacy and security
The plugin surfaces system-provided signals only. It does not log or transmit personally-identifying information.
Follow platform rules: you may only use information from the Play Age Signals API to provide age-appropriate content and experiences in compliance with laws. You may not use the Play Age Signals API for any other purpose including, but not limited to, advertising, marketing, user profiling, or analytics.
Implementation guide
App setup
Enable the AgeSafety plugin in Median App Studio before calling any JavaScript Bridge functions. Navigate to your app’s plugin settings and toggle AgeSafety on.
JavaScript Bridge guide
Core methods
getAgeSignals
Retrieve age and supervision signals from the platform.
// Using promisesconst resp = await median.ageSafety.getAgeSignals({ ageGates: [13, 17, 21] });console.log('Age signals:', resp);// Using callback methodsmedian.ageSafety.getAgeSignals({ ageGates: [13, 17] }, function (resp) { console.log('Age signals callback:', resp);}, function (err) { console.error('AgeSafety error (callback)', err);});
Return value (resolved Promise/success callback) is an AgeSignalsResponse.
requireMinimumAge
A convenience helper that checks whether the user meets a numeric minimum age.
async function checkMinimumAge(requiredAge) { // Async/await style try { const resp = await median.ageSafety.requireMinimumAge(requiredAge); if (resp.allowed) { // show content } else { // show age-gated message } } catch (err) { console.error('Age safety check failed', err); }}checkMinimumAge(13);// Callback stylemedian.ageSafety.requireMinimumAge(18, function (resp) { console.log('requireMinimumAge', resp.allowed);}, function (err) { console.error(err);});
AgeRequirementResponse.allowed is computed as ageLowerBound >= requiredAge when age bounds are available. If bounds are missing, allowed may be false, and an app-level conservative policy should apply.
Implementation example: gate a purchase flow
This example verifies a user’s age before allowing a purchase, routes supervised accounts to a parental-approval flow, and falls back conservatively when signals are unavailable.
async function attemptPurchase() { try { const resp = await median.ageSafety.getAgeSignals({ ageGates: [18] }); if (resp.ageLowerBound >= 18) { // proceed with purchase } else if (resp.supervisorApprovalRequired) { // show parent approval flow } else { // block purchase and show message } } catch (err) { // fallback: conservative block or soft-check console.error('Age check failed', err); }}
Play Age Signals entitlement missing or unsupported OS
Provide a conservative fallback; do not block the entire flow
API_ERROR
Underlying platform API threw an exception
System-level error during age signal retrieval
Catch the error and apply a conservative default
USER_DENIED
User denied permission or signal is unavailable
iOS system prompt declined
Design your UI to apply a conservative default when verification is not available
UNKNOWN
Platform returned signals, but age bounds could not be determined
Age signal exists but is inconclusive
Treat identically to a missing signal: apply your conservative default
Testing checklist
Use this checklist to confirm AgeSafety is working correctly in your app:
getAgeSignals returns a valid response object on a supported device
requireMinimumAge returns allowed: true for users above the threshold
requireMinimumAge returns allowed: false for users below the threshold
Age signals return correctly on Android devices
Age signals return correctly on iOS devices
verificationMethod is present on iOS responses
Supervised-account detection works correctly on Family Link / Screen Time devices
NOT_SUPPORTED is handled gracefully with a conservative fallback
API_ERROR is caught and the app applies a conservative default
Missing ageLowerBound / ageUpperBound is handled gracefully when signals return UNKNOWN
Troubleshooting
AgeSafety functions are undefined or not working
Ensure the JavaScript Bridge is enabled in Median App Studio and that you’re calling the functions after the median_library_ready() event. Also verify that the plugin is enabled in your app configuration.
getAgeSignals always throws an error on some Android devices
During the beta period, Play Age Signals may return API_NOT_AVAILABLE or throw exceptions on some devices. Always wrap calls in a try/catch block and provide a conservative fallback for age-gated flows when signals are unavailable.
requireMinimumAge returns allowed: false even for adult users
If ageLowerBound is missing from the response (signals returned UNKNOWN), allowed will be false. This is expected behavior. Design your UI to apply a conservative default when verification is not available, and provide an alternative flow if needed.