Flutter SDK 中的儿童模式

如果您的 Flutter 应用面向儿童,则必须遵守 AppleGoogle 的相关政策。如果您正在使用 Adapty SDK,只需几个简单步骤即可将其配置为符合这些政策,并顺利通过应用商店审核。

需要做什么?

您需要配置 Adapty SDK,以禁用以下数据的收集:

此外,我们建议谨慎使用客户用户 ID。格式为 <FirstName.LastName> 的用户 ID 以及使用电子邮件,都将被视为收集个人数据。对于儿童模式,最佳实践是使用随机化或匿名化的标识符(例如哈希 ID 或设备生成的 UUID),以确保合规。

启用儿童模式

在 Adapty 看板中进行更新

在 Adapty 看板中,您需要禁用 IP 地址收集。为此,请前往 App settings,然后在 Collect users’ IP address 下点击 Disable IP address collection

在移动应用代码中进行更新

为了遵守相关政策,请禁用用户 IDFA(针对 iOS)、GAID/AAID(针对 Android)和 IP 地址的收集。

Android:更新您的 SDK 配置

try {
    await Adapty().activate(
        configuration: AdaptyConfiguration(apiKey: 'YOUR_API_KEY')
          ..withGoogleAdvertisingIdCollectionDisabled(true),  // set to `true`
          ..withIpAddressCollectionDisabled(true),  // set to `true`
    );
} catch (e) {
    // handle the error
}

iOS:使用 CocoaPods 启用儿童模式

  1. 更新您的 Podfile:

    • 如果您没有 post_install 部分,请添加以下完整代码块。
    • 如果您已有 post_install 部分,请将高亮行合并到其中。
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        // highlight-start
        if target.name == 'Adapty'
          target.build_configurations.each do |config|
            config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)']
            config.build_settings['OTHER_SWIFT_FLAGS'] << '-DADAPTY_KIDS_MODE'
          end
        end
        // highlight-end
      end
    end
  2. 运行以下命令应用更改:

    pod install