Skip to content

@capawesome/capacitor-age-signals

Capacitor plugin to use the Play Age Signals API to retrieve age-related signals for users.

Installation

npm install @capawesome/capacitor-age-signals
npx cap sync

Android

Variables

If needed, you can define the following project variable in your app's variables.gradle file to change the default version of the dependency:

  • $androidPlayAgeSignalsVersion version of com.google.android.play:age-signals (default: 0.0.1-beta01)

This can be useful if you encounter dependency conflicts with other plugins in your project.

Configuration

No configuration required for this plugin.

Usage

import { AgeSignals } from '@capawesome/capacitor-age-signals';

const checkAgeSignals = async () => {
  const result = await AgeSignals.checkAgeSignals();
  console.log('User Status:', result.userStatus);
  console.log('Age Lower:', result.ageLower);
  console.log('Age Upper:', result.ageUpper);
};

API

checkAgeSignals()

checkAgeSignals() => Promise<CheckAgeSignalsResult>

Request the user's age signals from Google Play.

Only available on Android.

Returns: Promise<CheckAgeSignalsResult>

Since: 0.0.1


Interfaces

CheckAgeSignalsResult

Prop Type Description Since
userStatus UserStatus The user's verification status. 0.0.1
ageLower number The (inclusive) lower bound of a supervised user's age range. Only available when userStatus is SUPERVISED, SUPERVISED_APPROVAL_PENDING, or SUPERVISED_APPROVAL_DENIED. 0.0.1
ageUpper number The (inclusive) upper bound of a supervised user's age range. Only available when userStatus is SUPERVISED, SUPERVISED_APPROVAL_PENDING, or SUPERVISED_APPROVAL_DENIED and the user's age is under 18. 0.0.1
mostRecentApprovalDate string The effective from date of the most recent significant change that was approved. When an app is installed, the date of the most recent significant change prior to install is used. Only available when userStatus is SUPERVISED_APPROVAL_PENDING or SUPERVISED_APPROVAL_DENIED. 0.0.1
installId string An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval. Only available when userStatus is SUPERVISED, SUPERVISED_APPROVAL_PENDING, or SUPERVISED_APPROVAL_DENIED. 0.0.1

Enums

UserStatus

Members Value Description Since
Verified 'VERIFIED' The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation. 0.0.1
Supervised 'SUPERVISED' The user has a supervised Google Account managed by a parent who sets their age. Use ageLower and ageUpper to determine the user's age range. 0.0.1
SupervisedApprovalPending 'SUPERVISED_APPROVAL_PENDING' The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes. Use ageLower and ageUpper to determine the user's age range. Use mostRecentApprovalDate to determine the last significant change that was approved. 0.0.1
SupervisedApprovalDenied 'SUPERVISED_APPROVAL_DENIED' The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes. Use ageLower and ageUpper to determine the user's age range. Use mostRecentApprovalDate to determine the last significant change that was approved. 0.0.1
Unknown 'UNKNOWN' The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18. To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status. 0.0.1
Empty 'EMPTY' All other users return this value. 0.0.1

Changelog

See CHANGELOG.md.

License

See LICENSE.