Google Play 遊戲電腦版的完整性防護措施
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
電腦版的 Google Play 遊戲支援完整防護功能,透過 Play Integrity API 和其他幾項 Google Play 功能,確保遊戲不會遭到竄改,或者從不可靠的來源安裝。
Play Integrity API
Play Integrity 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 服務的虛擬 Android 環境中執行,目前僅支援 Google Play 遊戲電腦版。該環境符合 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 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間: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)."]]