Getting Started
インストール手順とこのプラグインのフルマークダウンガイドを含むセットアッププロンプトをコピーします。
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.
インストール
「インストール」のセクションCapgoのAI-Assistedセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-age-range` plugin in my project.あなたがマニュアルセットアップを好む場合は、以下のコマンドを実行し、以下のプラットフォーム固有の説明を参照してください:
bun add @capgo/capacitor-age-rangebunx cap syncインポート
「インポート」のセクションimport { AgeRange } from '@capgo/capacitor-age-range';API オーバービュー
「API オーバービュー」のセクションrequestAgeRange
「requestAgeRange」のセクションユーザーの年齢範囲を要求する。
Androidでは、Google Play Age Signals API (ユーザープリミプトなし)をクエリします。 iOSでは、システムのDeclaredAgeRangeダイアログを表示します (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);}型参照
型参照RequestAgeRangeOptions
「型参照」年齢範囲要求のオプション
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
年齢範囲要求の結果クリップボードにコピー
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
年齢範囲要求のトップレベルステータス.]} ]}
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
セクション「宣言元」年齢範囲が宣言されたかどうかの説明です。
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
セクション「Androidユーザー状態」Android用のGoogle Playユーザー状態の値です。
export type AndroidUserStatus = | 'VERIFIED' | 'SUPERVISED' | 'SUPERVISED_APPROVAL_PENDING' | 'SUPERVISED_APPROVAL_DENIED' | 'UNKNOWN' | 'EMPTY';真実の源
セクション「真実の源」このページはプラグインの src/definitions.ts. 公開 API の上流で変更されたときに、再度同期を実行してください。
Getting Startedから続けてください
「Getting Started」から続けて」Capgoを使用している場合 Getting Started ダッシュボードとAPIの操作を計画するには、APIを接続します @capgo/capacitor-age-rangeを使用して、Capgoのネイティブ機能を使用します @capgo/capacitor-age-rangeのネイティブ機能の実装詳細については、capgo Overviewを参照してください APIの概要 実装詳細については、API Overviewを参照してください 導入 実装詳細については、Introductionを参照してください APIのキー 実装詳細については、API Keysを参照してください デバイス デバイスの実装詳細について