获得 ump/admob/资金选择同意的问题

问题描述

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

我做了什么:

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

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

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

        consent@R_124_4045@ion = UserMessagingPlatform.getConsent@R_124_4045@ion(this);
        consent@R_124_404[email protected](
                this,params,new Consent@R_124_404[email protected]() {
                    @Override
                    public void onConsentInfoUpdateSuccess() {
                        // The consent @R_124_4045@ion state was updated.
                        // You are Now ready to check if a form is available.
                        if (consent@R_124_404[email protected]()) {
                            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 Consent@R_124_404[email protected]() {
                    @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,duration);
                        toast.show();

                    }
                });

public void loadForm() {
        UserMessagingPlatform.loadConsentForm(
                this,new UserMessagingPlatform.OnConsentFormloadSuccessListener() {
                    @Override
                    public void onConsentFormloadSuccess(ConsentForm consentForm) {
                        MainActivity.this.consentForm = consentForm;
                        if(consent@R_124_404[email protected]() == Consent@R_124_404[email protected].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) 独立于我的手机或虚拟设备上的测试(顺便说一句,我在欧洲)中得到 Toast“错误”登陆。

我错过了什么吗?

谢谢, 塞尔德里

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)