Skip to main content
@capgo/capacitor-age-range Auth & Security Open source

Age Range Capacitor plugin

Cross-platform age range detection using Google Play Age Signals (Android) and Apple DeclaredAgeRange (iOS)

Install

bun add @capgo/capacitor-age-range bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-age-range
  • pnpm add @capgo/capacitor-age-range
  • yarn add @capgo/capacitor-age-range

Guide

How to use Age Range in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

Age Range plugin preview QR code

Using @capgo/capacitor-age-range

Cross-platform age range detection plugin.

Install

bun add @capgo/capacitor-age-range
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { AgeRange } from '@capgo/capacitor-age-range';

API at a glance

Method Description
requestAgeRange Request the user's age range.

Examples

requestAgeRange()

Request the user's age range.

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);
}

Full reference

Keep going from Using @capgo/capacitor-age-range

If you are using Using @capgo/capacitor-age-range to plan native plugin work, connect it with @capgo/capacitor-age-range for the implementation detail in @capgo/capacitor-age-range, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Age Range plugin FAQ

How do I install the Age Range plugin in a Capacitor app?

Run "bun add @capgo/capacitor-age-range" (or "npm install @capgo/capacitor-age-range"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-age-range" in your app code.

Does @capgo/capacitor-age-range work with React, Vue and Angular?

Yes. Age Range is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-age-range support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-age-range free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-age-range/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Age Range without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Age Range changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo