全局设置
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
以下全局函数可用于控制移动广告 SDK 收集的特定信息。
Google 移动广告 C++ SDK 使用发布商第一方 ID,利用从用户正在使用的应用中收集的数据,帮助您投放更具相关性、个性化程度更高的广告。
发布商第一方 ID 默认处于启用状态,但您可以在初始化之前使用以下代码将其停用:
#include "firebase/gma.h"
firebase::gma::SetIsSameAppKeyEnabled(/*is_enabled=*/false);
崩溃报告(仅限 iOS)
Google 移动广告 C++ SDK 会检查 iOS 应用中发生的异常,并会记录 SDK 所引发的异常。我们会收集这些异常,以便在将来的 SDK 版本中加以避免。
崩溃报告默认处于启用状态。如果您不想记录与 SDK 相关的异常,则可以通过调用 DisableSDKCrashReporting() 函数停用此功能。此方法的最佳调用时机是在应用启动时:
#include “firebase/gma.h”
firebase::gma::DisableSDKCrashReporting();
Android 设备不支持崩溃报告。
Cookie 意见征求
如果您的应用对 Android 有特殊要求,您可以设置可选的 SharedPreferences
gad_has_consent_for_cookies。如需了解详情,请参阅 Android 全局设置指南的Cookie 意见征求部分。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-02-07。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2026-02-07。"],[],["The Google Mobile Ads C++ SDK is deprecated as of June 17, 2024, and will reach End-of-Maintenance on June 17, 2025. Consider using the AdMob iOS and Android SDKs instead. Publisher first-party ID, enabled by default, can be disabled via `SetIsSameAppKeyEnabled(false)`. For iOS, crash reporting is on by default but can be disabled using `DisableSDKCrashReporting()`. Android consent for cookies can be set using `SharedPreferences` with `gad_has_consent_for_cookies`.\n"]]