
演艺圈
@capacitor-community/play-integrity
Play Guide API 用于校验您的应用程序是Genuine App 二进制,与 Play Store 上可用的设备相比没有修改过. 它验证了当前用户账户持有许可(安装或支付您的应用程序的用户),以及该应用程序是否没有已知的恶意软件.
此插件称为 Play 完整性 API requestIntegrityToken 返回您 App 服务器必须使用 Google Play 服务器校验的符号的方法 .
电话 requestIntegrityToken 将返回 a token 用于验证。 见 Google的文档对此。 。 。 .
安装
npm install @capacitor-community/play-integrity
npx cap sync
使用量
import { PlayIntegrity } from '@capacitor-community/play-integrity';
...
try {
// Nonce: See https://developer.android.com/google/play/integrity/classic
// googleCloudProjectNumber: leave as 0 for the default for the application
// or get from https://console.firebase.google.com/ Project Settings > General
const result = await PlayIntegrity.requestIntegrityToken({
nonce: nonce,
googleCloudProjectNumber: 0
});
// Use result.token and decrypt and verify the integrity verdict
// https://developer.android.com/google/play/integrity/classic#decrypt-verify
console.log(`Play Integrity Result`, result);
} catch (err) {
// Recommendation: Report to backend and exit the application
}
机器人
变量
此插件将使用以下工程变量( 在您的应用程序中定义) variables.gradle 文件名 :
googlePlayIntegrityVersion页:1com.google.android.play:integrity(默认 :1.6.0(中文(简体) )
API 密码
请求集成托肯(...)
requestIntegrityToken(options: { nonce: string; googleCloudProjectNumber: number; }) => Promise<{ token: string; }>
| 参数 | 类型 |
|---|---|
options | { nonce: string; googleCloudProjectNumber: number; } |
回返情况: Promise<{ token: string; }>
错误
下列出错可以发生,应当处理.
完整性 API 不可用
Error: -1: Integrity API error (-1): Integrity API is not available.
Integrity API is not enabled, or the Play Store version might be old.
Recommended actions:
1) Make sure that Integrity API is enabled in Google Play Console.
2) Ask the user to update Play Store.
(https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/IntegrityErrorCode.html#API_NOT_AVAILABLE).
未找到播放服务
Play Services not found