---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/android/tcf-2-0.md
  - https://ads.yandex.com/helpcenter/ru/dev/android/tcf-2-0.md
  - https://ads.yandex.com/helpcenter/zh/dev/android/tcf-2-0.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/zh/llms.txt

# TCF v2.0 同意



如果您为用户同意流程实施了符合 IAB [透明度和同意框架](https://iabeurope.eu/tcf-2-0/) v2.0 (TCF) 的同意管理平台 (CMP)，则Yandex Mobile Ads SDK 支持发送 TCF v2.0 值。

Yandex Mobile Ads SDK 使用以下键从 `SharedPreferences` 检索 TCF v2.0 同意字符串：

#|
|| `IABTCF_TCString` | 字符串 | 完全编码的 TC 字符串。||
|| `IABTCF_gdprApplies` | 数值 |
* 1：GDPR 适用于当前情况。
* 0：GDPR 不适用于当前情况。
* 取消设置：未知（初始化前的默认值）。||
   || `IABTCF_CmpSdkID` | 数值 |使用的经过认证的 CMP 的无符号整数 `ID`。||
   || `IABTCF_PurposeConsents` | 二进制字符串 | 位置 n 处的“0”或“1”，其中 n 的索引从 0 开始。指示目的 `ID` n+1 的同意状态。0 对应 `false`，1 对应 `true`。例如，索引“0”处的“1”表示目的 `ID` 1 的同意为真。||
   || `IABTCF_VendorConsents` | 二进制字符串 | 位置 n 处的“0”或“1”，其中 n 的索引从 0 开始。指示供应商 `ID` n+1的同意状态。0 对应 `false`，1 对应 `true`。例如，索引“0”处的“1”表示供应商 `ID` 1 的同意为真。||
   || `IABTCF_AddtlConsent` | 字符串 | AC 字符串，包含规范版本和用户同意的广告技术提供商的 ID。||
   |#

有关详细说明，请参阅 [IAB 文档](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md)。

## 将值传递至 SharedPreferences

确保在发出广告请求之前设置所需的键值并使用经过认证的 CMP。请在 [此处](https://iabeurope.eu/cmp-list) 查看符合 IAB Europe 建议的最新 CMP 列表。获得用户同意后，CMP 将通过密钥将所有数据写入 `SharedPreferences`，而 Yandex Mobile Ads SDK 会自动读取数据。

