Android集成Google UMP实现隐私同意流程时出现发布者配置报错
Android AdMob UMP 集成报错记录
开发背景
- 集成目标:在Android应用内通过User Messaging Platform实现Google Consent合规能力,向用户展示符合要求的同意表单
- 开发依据:严格遵循AdMob官方UMP快速入门文档的流程要求完成开发
运行期异常表现
应用触发UMP请求同意信息更新流程时,日志返回如下报错:
onConsentInfoUpdateFailure: Publisher misconfiguration: Failed to read publisher's account configuration; please check your configured app ID. Received app ID: `ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX`.
报错核心指向:UMP服务端判定存在发布者配置错误,无法关联读取到对应账户的配置信息,提示需要校验已配置的应用ID准确性
核心实现代码
ConsentRequestParameters params; if (testingGDPR) { ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this) .setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA) .addTestDeviceHashedId(getString(R.string.ADMOB_REAL_DEVICE_HASH_ID_FOR_TESTING)) .build(); params = new ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build(); } else { params = new ConsentRequestParameters.Builder().build(); } consentInformation = UserMessagingPlatform.getConsentInformation(this); if (testingGDPR) { consentInformation.reset(); } consentInformation.requestConsentInfoUpdate( this, params, new ConsentInformation.OnConsentInfoUpdateSuccessListener() { @Override public void onConsentInfoUpdateSuccess() { if (consentInformation.isConsentFormAvailable() && consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) { loadForm(); } else { setupAds(); } } }, new ConsentInformation.OnConsentInfoUpdateFailureListener() { @Override public void onConsentInfoUpdateFailure(FormError formError) { Log.d("gdpr", "onConsentInfoUpdateFailure, code:" + formError.getErrorCode() + ", " + formError.getMessage()); } });
内容的提问来源于stack exchange,提问作者HamzaSamir
相关产品推荐
相关产品推荐

