play_age_signals 0.0.1 copy "play_age_signals: ^0.0.1" to clipboard
play_age_signals: ^0.0.1 copied to clipboard

Flutter library to interact with Google Play Age Signals

Play Age Signals #

A Flutter plugin for Google Play Age Signals API and iOS equivalents.

This plugin allows you to request age verification signals in a privacy-preserving way, supporting both Android's Play Age Signals API and iOS equivalents (returning a restricted status where not available).

Features #

  • Check Age Signals: Retrieve the user's age verification status (Verified, Supervised, etc.).
  • Testing Support: Full support for FakeAgeSignalsManager on Android and mock results on iOS for integration testing.

Getting Started #

Android #

No special configuration is required beyond the standard Flutter setup. The plugin includes the com.google.android.play:age-signals dependency.

iOS #

The plugin uses the FamilyControls framework to check for supervision status.

  • Returns AgeSignalsVerificationStatus.supervised if the app has AuthorizationStatus.approved from Family Controls.
  • Returns AgeSignalsVerificationStatus.unknown otherwise.
  • Minimum iOS version: 15.0.

Note: To use this on a real device, you must add the "Family Controls" capability in Xcode.

Usage #

import 'package:play_age_signals/play_age_signals.dart';

final _playAgeSignalsPlugin = PlayAgeSignals();

// Check signals
try {
  final result = await _playAgeSignalsPlugin.checkAgeSignals();
  print('Status: ${result.status}');
} on PlatformException catch (e) {
  print('Error: ${e.message}');
}

Testing #

You can enable test mode to simulate responses without hitting the real API or needing a specific account setup.

// Enable test mode
await _playAgeSignalsPlugin.setTestMode(true);

// Set a mock result (e.g. Verified Adult)
await _playAgeSignalsPlugin.setMockResult(
  AgeSignalsResult(status: AgeSignalsVerificationStatus.verified)
);

// Now checkAgeSignals() will return the mocked result
final result = await _playAgeSignalsPlugin.checkAgeSignals();