Ham*_*mir 5 java android admob gdprconsentform user-messaging-platform
我尝试将 Google Consent 与用户消息传递平台结合使用,以在 Android 应用同意表中显示。我遵循此文档https://developers.google.com/admob/ump/android/quick-start。
我收到此错误:
onConsentInfoUpdateFailure: Publisher misconfiguration: Failed to read publisher's account configuration; please check your configured app ID. Received app ID: `ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX`.
Run Code Online (Sandbox Code Playgroud)
我的代码:
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());
}
});
Run Code Online (Sandbox Code Playgroud)
TestDeviceHashedId 与 Admob 设备 ID 不同。所以删除这一行:
.addTestDeviceHashedId(getString(R.string.ADMOB_REAL_DEVICE_HASH_ID_FOR_TESTING))
Run Code Online (Sandbox Code Playgroud)
然后运行您的代码并检查日志。您应该使用的 TestDeviceHashedId 将出现。
归档时间: |
|
查看次数: |
1517 次 |
最近记录: |