Skip to content

Gautham495/react-native-play-age-range-declaration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
react-native-play-age-range-declaration

react-native-play-age-range-declaration (Alpha)

A React Native Nitro Module providing a unified API for age-appropriate experiences across platforms β€” bridging:

  • 🟒 Google Play Age Signals API (Android)
  • πŸ”΅ Apple Declared Age Range API (iOS 26+)

Built using the Nitro Modules framework by Margelo for high-performance, fully typed native integration.

Important

  • The APIs for both Google & Apple's Age Signal & Declared Age Range are not responding with full required info as of October 2025.
  • Once they are working as intended I will update according to their API changes

πŸ“¦ Installation

npm install react-native-play-age-range-declaration react-native-nitro-modules

βš™οΈ Configuration

Nitro Modules autolink automatically β€” no manual steps required.

βœ… Works with

  • React Native 0.76+ (New Architecture)
  • Expo Custom Dev Clients
  • TypeScript

🧠 Overview

Platform API Used Purpose
Android Play Age Signals API (com.google.android.play:age-signals) Detect user supervision / verified status
iOS Declared Age Range API (AgeRangeService.requestAgeRange) Get user’s declared age range (e.g., 13–15, 16–17)

βš™οΈ Usage

import { getAgeData } from 'react-native-play-age-range-declaration';

export default async function Example() {
  try {
    // Android β†’ returns Play Age Signals
    // iOS β†’ opens Declared Age Range UI
    const result = await getAgeData(16);
    console.log('Age Range Result:', result);
  } catch (err) {
    console.error('Error fetching age range:', err);
  }
}

🧩 API Reference

PlayAgeRangeDeclaration (HybridObject)

import type { HybridObject } from 'react-native-nitro-modules';

export interface PlayAgeRangeDeclaration
  extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
  getPlayAgeRangeDeclaration(): Promise<PlayAgeRangeDeclarationResult>;
  requestDeclaredAgeRange(ageGate: number): Promise<DeclaredAgeRangeResult>;
}

export interface PlayAgeRangeDeclarationResult {
  installId?: string | null;
  userStatus?: string | null;
  error?: string | null;
}

export interface DeclaredAgeRangeResult {
  status?: string | null;
  lowerBound?: number | null;
  upperBound?: number | null;
  error?: string | null;
}

πŸ“± Example Output

🟒 Android – Play Age Signals

{
  "installId": "abcd-1234-efgh-5678",
  "userStatus": "SUPERVISED"
}

πŸ”΅ iOS – Declared Age Range

{
  "status": "sharing",
  "lowerBound": 16,
  "upperBound": 17
}

🧱 Under the Hood

🟩 Android

Implemented in Kotlin using Nitro’s async promises:

val manager = AgeSignalsManagerFactory.create(appContext)
val request = AgeSignalsRequest.builder().build()
manager.checkAgeSignals(request)

Wrapped in:

Promise.async {
  suspendCancellableCoroutine { cont -> ... }
}

No RCT_EXPORT_MODULE β€” pure Nitro interop.


🟦 iOS

Implemented in Swift using Nitro async promises and Apple’s Declared Age Range API:

let response = try await AgeRangeService.shared.requestAgeRange(
  ageGates: intGate,
  in: viewController
)

Bridged via:

class PlayAgeRangeDeclaration: HybridPlayAgeRangeDeclarationSpec { ... }

🧾 Real-World Use Case

Comply with digital safety and age-appropriate design laws automatically:

  • Android β†’ Play Age Signals (COPPA & supervision data)
  • iOS β†’ Declared Age Range (Apple’s privacy-preserving age disclosure)

🧩 Supported Platforms

Platform Status
Android βœ… Supported (SDK Beta)
iOS 26+ βœ… Supported
Expo Custom Dev Client βœ… Supported via Nitro autolinking
AOSP Emulator ⚠️ Not supported (requires Play)

🧭 Roadmap

  • βœ… Kotlin + Swift Nitro implementation
  • βœ… Cross-platform TypeScript definitions
  • βœ… Async Promise bridge
  • 🚧 Add example app with Fabric UI demo
  • 🚧 Add GitHub Actions auto-publish pipeline

🀝 Contributing

Pull requests welcome!


πŸͺͺ License

MIT Β© Gautham Vijayan


Made with ❀️ and Nitro Modules

About

React Native Nitro Module to access Google Play's Age Signals API & Apple's Declared Age Range API - Alpha

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published