【问题标题】:Problem with obtaining consent with ump / admob / funding choices使用 ump / admob / 资金选择获得同意的问题
【发布时间】:2021-10-02 02:54:08
【问题描述】:

按照本指南 https://developers.google.com/admob/ump/android/quick-start 我尝试将所有内容添加到我的应用程序中。

我做了什么:

  • 将资金选择链接到 admob
  • 将 ump 添加到 build.gradle
  • 将应用 ID 添加到 android 清单中
  • 在 admob 中为应用设置对话框并为应用激活它

然后我将此代码添加到我的应用程序中

ConsentRequestParameters params = new ConsentRequestParameters
                .Builder()
                .setTagForUnderAgeOfConsent(false)
                .build();

        consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
                this,
                params,
                new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
                    @Override
                    public void onConsentInfoUpdateSuccess() {
                        // The consent information state was updated.
                        // You are now ready to check if a form is available.
                        if (consentInformation.isConsentFormAvailable()) {
                            loadForm();
                        }
                        else {

                        Context context = getApplicationContext();

                        CharSequence toastText = "No Form Available";

                        int duration = Toast.LENGTH_LONG;

                        Toast toast = Toast.makeText(context, toastText, duration);
                        toast.show();
                        }

                        
                    }

                },
                new ConsentInformation.OnConsentInfoUpdateFailureListener() {
                    @Override
                    public void onConsentInfoUpdateFailure(FormError formError) {
                        // Handle the error.
                        
                        Context context = getApplicationContext();

                        CharSequence toastText = "Error";

                        int duration = Toast.LENGTH_LONG;

                        Toast toast = Toast.makeText(context, toastText, duration);
                        toast.show();

                    }
                });

public void loadForm() {
        UserMessagingPlatform.loadConsentForm(
                this,
                new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
                    @Override
                    public void onConsentFormLoadSuccess(ConsentForm consentForm) {
                        MainActivity.this.consentForm = consentForm;
                        if(consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) {
                            consentForm.show(
                                    MainActivity.this,
                                    new ConsentForm.OnConsentFormDismissedListener() {
                                        @Override
                                        public void onConsentFormDismissed(@Nullable FormError formError) {
                                            // Handle dismissal by reloading form.
                                            loadForm();
                                        }
                                    });

                        }
                    }
                },
                new UserMessagingPlatform.OnConsentFormLoadFailureListener() {
                    @Override
                    public void onConsentFormLoadFailure(FormError formError) {
                        // Handle the error
                    }
                }
        );
    }

但是,我总是在 onConsentInfoUpdateFailure(FormError formError) 独立于在我的手机或虚拟设备上进行测试(顺便说一句我在欧洲)。

我错过了什么吗?

谢谢, 塞尔德里

【问题讨论】:

    标签: java android gdprconsentform


    【解决方案1】:

    我遇到了同样的问题,我只是通过正确配置我的 adMob 帐户来解决它。

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    • 您能告诉我您的 adMob 帐户出了什么问题吗?我问了谷歌支持,他们也帮不了我。
    猜你喜欢
    • 1970-01-01
    • 2021-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多