You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用UserMessagingPlatform无法展示GDPR同意表单,求助解决

问题:GDPR同意消息无法正常显示

我按照Google AdMob安卓隐私指南实现GDPR同意消息展示,但始终无法成功显示。参考文档中隐私选项部分的代码并修改后,最终代码如下:

consentInformation = UserMessagingPlatform.getConsentInformation(this);
consentInformation.requestConsentInfoUpdate(
        this,
        params,
        (ConsentInformation.OnConsentInfoUpdateSuccessListener) () -> {
            UserMessagingPlatform.loadAndShowConsentFormIfRequired(
                    this,
                    (ConsentForm.OnConsentFormDismissedListener) loadAndShowError -> {
                        // ...

                        // Consent has been gathered.

                        if (isPrivacyOptionsRequired()) {
                            // Regenerate the options menu to include a privacy setting.
                            ConsentVisibility = true;
                        }
                        else ConsentVisibility = false;
                    }
            );
        },
        (ConsentInformation.OnConsentInfoUpdateFailureListener) requestConsentError -> {
            // Consent gathering failed.
            Log.d("ConsentF", String.format("%s: %s",
                    requestConsentError.getErrorCode(),
                    requestConsentError.getMessage()));
        });

我已尝试以下操作:

  • 使用测试选项测试
  • 不使用测试选项测试
  • 在模拟器和实体设备上测试
  • 关闭广告拦截器

无论进行何种操作,同意表单都无法显示。

补充说明:已在Google控制台中添加同意表单。

内容的提问来源于stack exchange,提问作者kriki200

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 23:42:33