androidRequestIntegrityToken method

Future<AndroidIntegrityResult> androidRequestIntegrityToken(
  1. int? cloudProjectNumber,
  2. String data
)

Requests an Android Play Integrity API token for app verification.

This method initiates a Play Integrity check to verify the app's authenticity, device integrity, and licensing status. The integrity token can be used to validate that the app is running on a genuine Android device and has not been tampered with.

Parameters:

  • cloudProjectNumber: Optional Google Cloud project number for enhanced verification. If provided, enables additional Play Console integration features.
  • data: Challenge data to include in the integrity request for replay protection

Returns a Future that completes with an AndroidIntegrityResult containing the integrity token and verification status.

Platform Support: Android with Google Play Services

Throws UnimplementedError if not overridden by platform implementation.

Example:

final result = await CalljmpDevice.instance.androidRequestIntegrityToken(
  123456789, // Your Google Cloud project number
  base64Encode(utf8.encode('nonce-data')),
);
print('Package: ${result.packageName}');
print('Token: ${result.integrityToken}');

Implementation

Future<AndroidIntegrityResult> androidRequestIntegrityToken(
  int? cloudProjectNumber,
  String data,
) {
  throw UnimplementedError(
    'androidRequestIntegrityToken() has not been implemented.',
  );
}