0
ConsentInformation consentInformation = ConsentInformation.getInstance(that);
                String[] publisherIds = {"pub-XYZYXYZYXYZYXYZXY"};
                consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() {
                    @Override
                    public void onConsentInfoUpdated(ConsentStatus consentStatus) {
                        Consent consent = new Consent();
                        if(!ConsentInformation.getInstance(that).isRequestLocationInEeaOrUnknown()) {
                            consentCallback(that, new AdRequest.Builder().build());
                        } else {
                            if(consentStatus == ConsentStatus.NON_PERSONALIZED) {
                                Bundle extras = new Bundle();
                                extras.putString("npa", "1");
                                AdRequest adRequest = new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class, extras).build();
                                consentCallback(that, adRequest);
                            } else if(consentStatus == ConsentStatus.PERSONALIZED) {
                                consentCallback(that, new AdRequest.Builder().build());
                            } else if(consentStatus == ConsentStatus.UNKNOWN) {
                                consent.collectConsent(that, miscellaneous, new ConsentInterface() {
                                    @Override
                                    public void callbackConsentInterface(AdRequest adRequest) {
                                        consentCallback(that, adRequest);
                                    }
                                });
                            }
                        }
                    }

如您所见,我已经正确指出了我的 Pub ID(如在类似问题中突出显示的那样:Android - ConsentInformation - Could not parse Event FE preflight response)。

但是我仍然有这个错误:

W/System.err:无法解析事件 FE 预检响应。

我能做些什么来修复这个错误?

我确切地说我没有在 Google AdMob 中输入我的银行帐户信息,并且出于坚定和技术原因我无法进行测试。

4

2 回答 2

2

通过严格遵循我想象的这三个步骤,我已经解决了我的问题。我已经测试了它们的几乎所有组合:如果不遵循其中一个步骤,您将收到“无法解析事件”。否则,您将不会收到此错误。

  1. 遵循这些文档:https ://developers.google.com/admob/android/eu-consent + https://firebase.google.com/docs/admob(“Android入门”)+ https://developers。 google.com/admob(“Android设置”)

  2. 请务必在 Consent API 的 Publisher IDs 数组中指定您的Publisher ID ( https://support.google.com/admob/answer/2784578 )

  3. 重要提示:在您的 Google AdMob 帐户 ( https://apps.admob.com/v2/payments/settings )中填写您的付款信息(不是指您的信用卡或任何其他付款方式,而是指您的生活坐标)

  4. 等待 <= 24 小时

  5. 按照上述文档,创建您的 AdMob“应用程序”等。

  6. 确保在“阻止控制 > 欧盟同意 > 选择广告技术提供商”(https://apps.admob.com/v2/pubcontrols/eu-user-consent)中选择了一些提供商(通常不可能不选择某些内容)

  7. [未测试但在 Internet 上找到] 在您的 App-Level Gradle 文件中,请确保具有:

    缩小启用假

    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

然后它应该工作。

于 2020-04-25T09:01:25.577 回答
1

如果您的 AdMob 帐户尚未获得批准,则可能会出现该错误。等到“审核中”消息消失,然后重试。

于 2020-04-30T11:19:20.297 回答