Getting Started
Copiez un prompt de configuration avec les étapes d'installation et le guide Markdown complet pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-age-range`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/age-range/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Section intitulée « Installer »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-age-range` plugin in my project.Si vous préférez la mise en place manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
bun add @capgo/capacitor-age-rangebunx cap syncImporter
Section intitulée “Importer”import { AgeRange } from '@capgo/capacitor-age-range';API Vue d'ensemble
Section intitulée “API Vue d'ensemble”requestAgeRange
Section intitulée “requestAgeRange”Demander la plage d'âge de l'utilisateur.
Sur Android : interroge les signaux d'âge Google Play API (sans invitation de l'utilisateur). Sur iOS : présente le dialogue système DeclaredAgeRange (exige iOS 26.2+).
import { AgeRange } from '@capgo/capacitor-age-range';
const result = await AgeRange.requestAgeRange({ ageGates: [13, 16, 18] });if (result.status === 'SHARING') { console.log('Age range:', result.ageLower, '-', result.ageUpper);}Référence de type
Section intitulée « Référence de type »RequestAgeRangeOptions
Section intitulée « Options de plage d'âge pour la demande »Options pour la demande de plage d'âge
export interface RequestAgeRangeOptions { /** * Age thresholds for the request. * * On iOS: these are passed to `requestAgeRange(ageGates:)` as the * age boundaries presented in the system dialog. Common values: [13, 16, 18]. * * On Android: this parameter is ignored (Play Age Signals returns * predefined ranges: 0-12, 13-15, 16-17, 18+). * * @default [13, 16, 18] * @since 8.0.0 */ ageGates?: number[];}AgeRangeResult
Section intitulée « Résultat de la plage d'âge »Résultat de la demande de plage d'âge
export interface AgeRangeResult { /** * The outcome status of the age range request. * * @since 8.0.0 */ status: AgeRangeStatus;
/** * Inclusive lower bound of the user's age range. * * Present when age data is available. * * @since 8.0.0 */ ageLower?: number;
/** * Inclusive upper bound of the user's age range. * * May be absent if the user is in the highest age bracket (e.g. 18+). * * @since 8.0.0 */ ageUpper?: number;
/** * How the age was declared/determined. * * On iOS: 'SELF_DECLARED' or 'GUARDIAN_DECLARED'. * On Android: 'SUPERVISED' (guardian-managed) or 'VERIFIED' (Google-verified 18+). * * @since 8.0.0 */ declarationSource?: DeclarationSource;
/** * Android-only. The user's Google Play verification status. * * @since 8.0.0 */ androidUserStatus?: AndroidUserStatus;
/** * Android-only. Effective date for the most recent guardian-approved change. * * @since 8.0.0 */ mostRecentApprovalDate?: string;
/** * Android-only. Install identifier for supervised installs in Google Play. * * @since 8.0.0 */ installId?: string;}AgeRangeStatus
Section intitulée « Statut de la plage d'âge »Statut principal de la demande de plage d'âge
export type AgeRangeStatus = /** * The user shared their age range (iOS) or age signals are available (Android). */ | 'SHARING' /** * The user declined to share their age range. */ | 'DECLINED_SHARING' /** * The age range API is not available on this device/OS version. */ | 'NOT_AVAILABLE' /** * An error occurred while requesting the age range. */ | 'ERROR';DeclarationSource
Section intitulée « Source de déclaration »Comment la plage d'âge a été déclarée ou déterminée.
export type DeclarationSource = /** The user self-declared their age (iOS). */ | 'SELF_DECLARED' /** A guardian declared the user's age (iOS Family Sharing or Android supervised). */ | 'GUARDIAN_DECLARED' /** Google has verified the user is 18+ (Android only). */ | 'VERIFIED' /** Source is unknown or not provided by the platform. */ | 'UNKNOWN';AndroidUserStatus
Section intitulée “AndroidUserStatus”Valeurs de statut d'utilisateur Google Play spécifiques à Android.
export type AndroidUserStatus = | 'VERIFIED' | 'SUPERVISED' | 'SUPERVISED_APPROVAL_PENDING' | 'SUPERVISED_APPROVAL_DENIED' | 'UNKNOWN' | 'EMPTY';Source De Vérité
Section intitulée “Source De Vérité”Cette page est générée à partir du plugin’s src/definitions.tsRe-run la synchronisation lorsque le public API change en amont.
Continuez de Getting Started
Section intitulée “Continuez de Getting Started”Si vous utilisez Démarrage pour planifier le tableau de bord et les opérations API, connectez-le à Utilisation de @capgo/capacitor-âge pour la capacité native dans l'utilisation de @capgo/capacitor-âge Présentation de API pour le détail d'implémentation dans Présentation de API Introduction pour le détail d'implémentation dans Introduction Clés de API pour le détail d'implémentation dans Clés de API et Appareils pour le détail d'implémentation dans Appareils.