Google Play 游戏电脑版的完整性保护
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Play 游戏电脑版通过 Play Integrity API 和其他一些 Google Play 功能来支持完整性保护;这些其他功能有助于确保您的游戏不会遭到不可信来源的篡改或从不可信来源安装。
Play Integrity API
Play Integrity API 有助于保护您的游戏,使其免受可能存在风险的欺诈性互动的危害。借助此 API,您可以减少攻击和滥用行为,例如欺诈、欺骗和未经授权的访问。Play Integrity API 取代了 SafetyNet Attestation API (SNAA) 和 Play App Licencing API。SNAA 不适用于 Google Play 游戏电脑版。
设备完整性字段
deviceRecognitionVerdict
字段包含单个值,即 deviceRecognitionVerdict
,它表示设备可以在多大程度上强制执行应用完整性。默认情况下,deviceRecognitionVerdict
可以具有以下某个值:
MEETS_DEVICE_INTEGRITY
:应用正在已安装 Google Play 服务的 Android 设备上运行。设备通过了系统完整性检查,并且满足 Android 兼容性要求。
MEETS_VIRTUAL_INTEGRITY
:应用正在已安装 Google Play 服务(目前仅限于 Google Play 游戏电脑版)的虚拟 Android 环境中运行。该环境满足核心 Android 兼容性要求,并且通过了 Google Play 完整性检查。
- 无(一个空白值):应用正在有攻击迹象(如 API 挂接)或系统被侵迹象(如取得 root 权限)的设备上运行,或者应用正在未通过 Google Play 完整性检查的非实体设备(如模拟器)上运行。
Play Integrity API 使用 deviceRecognitionVerdict
值 MEETS_VIRTUAL_INTEGRITY
来指示游戏正在 Google Play 游戏电脑版上运行。以下是 Play Integrity API 发出的表示已通过完整性检查的响应示例:
deviceIntegrity: {
// "MEETS_VIRTUAL_INTEGRITY" indicates the game is running on Google Play Games on PC
deviceRecognitionVerdict: ["MEETS_VIRTUAL_INTEGRITY"]
}
如果您的跨平台游戏同时在移动平台和 Google Play 游戏电脑版上提供,请确保您的验证逻辑会检查 MEETS_VIRTUAL_INTEGRITY
和 MEETS_DEVICE_INTEGRITY
。
自动保护
Google Play 的自动保护功能有助于保护您的游戏,防范未经授权的再分发和盗版行为。如果用户从未知分发渠道获取您的受保护应用,系统会提示他们从 Google Play 获取您的官方应用。自动保护功能在没有数据连接的情况下也可保护您的应用。此功能可在 Play 管理中心一键开启,无需开发者在测试前做任何工作,也无需进行后端服务器集成。自动保护功能可为您的游戏添加以下功能:
- 安装程序检查:自动保护功能可在应用打开时,将 Google Play 安装程序检查功能添加到应用代码中,以便在运行时进行检查。如果未能通过安装程序检查,系统会提示用户通过 Google Play 获取应用。
- 防篡改保护(此功能仅面向部分 Play 合作伙伴提供):自动保护功能可以为应用代码添加运行时检查机制,以检测修改行为,并使用先进的混淆技术来防止这些检查被移除或逆向工程。如果检查失败,系统会提示用户从 Google Play 获取您的应用,否则应用将无法运行。
自动保护功能无需在测试前进行任何代码更改或开发工作。如需详细了解自动保护功能,请访问 Play 管理中心帮助中心。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Integrity protection for Google Play Games on PC\n\nGoogle Play Games on PC supports integrity protection through the Play\nIntegrity API and several other Google Play features to help ensure that\nyour game hasn't been tampered with or installed from an untrustworthy source.\n\nPlay Integrity API\n------------------\n\nThe [Play Integrity API](/google/play/integrity) helps protect your\ngames from potentially risky and fraudulent interactions. The API\nenables you to reduce attacks and abuse such as\nfraud, cheating, and unauthorized access. The\n[Play Integrity API](/google/play/integrity) replaces the\nSafetyNet Attestation API (SNAA) and Play App Licencing API.\nSNAA does not work with Google Play Games on PC.\n\n### Device Integrity Field\n\nThe\n[`deviceRecognitionVerdict`](/google/play/integrity/verdict#device-integrity-field)\nfield contains a single value, `deviceRecognitionVerdict`,\nthat represents how well a device can enforce app integrity. By default,\n`deviceRecognitionVerdict` can have one of these values:\n\n- `MEETS_DEVICE_INTEGRITY`: The app is running on an Android-powered device with Google Play services. The device passes system integrity checks and meets Android compatibility requirements.\n- `MEETS_VIRTUAL_INTEGRITY`: The app is running in a virtual Android environment with Google Play services, currently limited to Google Play Games on PC. The environment meets core Android compatibility requirements and passes Google Play integrity checks.\n- None (a blank value): The app is running on a device that has signs of attack (such as API hooking) or system compromise (such as being rooted), or the app is running on a non-physical device (such as an emulator) that does not pass Google Play integrity checks.\n\nThe Play Integrity API uses the `deviceRecognitionVerdict` value\n`MEETS_VIRTUAL_INTEGRITY` to indicate that the game is running on Google Play Games on PC. Here's an example of a passing response from\nthe Play Integrity API: \n\n deviceIntegrity: {\n // \"MEETS_VIRTUAL_INTEGRITY\" indicates the game is running on Google Play Games on PC\n deviceRecognitionVerdict: [\"MEETS_VIRTUAL_INTEGRITY\"]\n }\n\nIf you have a cross-platform game available on both mobile and\nGoogle Play Games on PC, make sure your\nvalidation logic checks for both `MEETS_VIRTUAL_INTEGRITY` and\n`MEETS_DEVICE_INTEGRITY`.\n\nAutomatic protection\n--------------------\n\nGoogle Play's [automatic protection](https://support.google.com/googleplay/android-developer/answer/10183279) is a service\nthat helps you protect your game against unauthorized redistribution and\npiracy. When users get your protected app from an unknown distribution\nchannel, they'll be prompted to get your official app from\nGoogle Play. Automatic protection works in your app without a data\nconnection. It can be turned on with one click in the\nPlay Console, and requires no developer work before testing and no\nbackend server integration. Automatic protection can add the following\nfeatures to your game:\n\n- **Installer checks**: Automatic protection can add Google Play installer checks to your app's code that happen at runtime when your app is opened. If the installer checks fail, users will be prompted to get your app on Google Play.\n- **Anti-tamper protection** **(this feature is only available to selected Play partners)**: Automatic protection can add runtime checks to your app's code to detect modification and use advanced obfuscation techniques to prevent the checks from being removed or reverse engineered. If the checks fail, the user will be prompted to get your app on Google Play or the app will not run.\n\nAutomatic protection requires no code changes or developer work before\ntesting. Learn more about\n[automatic protection in the Play Console help center](https://support.google.com/googleplay/android-developer/answer/10183279)."]]