在实施谷歌UMP SDK以获得欧盟用户的同意后,我在 AdMob(iOS 和 Android 应用程序)上遇到了以下错误:
检测到 IAB TCF v2.0 错误我们在您的一个或多个网站或应用程序上检测到您的 IAB TC 字符串存在问题。这些错误可能会影响您向欧洲用户投放广告的能力。欧盟用户同意页面上为您提供了详细报告。
在可下载的 .csv 文件中,我看到以下内容:
但是没有信息如何通过 SDK 做到这一点。
你知道如何解决这个问题吗?在这种情况下,我似乎失去了欧盟用户的所有流量。
谢谢你。
Android,即使用户不同意或用户关闭表单,UMP 也始终返回“OBTAINED”。所以很难用它做任何事情。我想知道用户是否不同意,在这种情况下关闭应用程序。然后下次打开应用程序时,应该立即显示表单。然而,另一个问题是,当用户在表单中选择内容并批准同意时,下次再次打开表单时,设置将被重置(就像表单从未保存过一样)。另一个问题是,用户几乎不可能选择正确的内容来获取广告,并且在大多数情况下,用户将获得一个没有任何广告的免费应用程序(因为 OBTAINED 状态并不能说明用户是否同意)。另外,我无法获取用户选择的内容(我真的需要查看共享首选项才能获取该信息吗?总体而言,这个 UMP 似乎工作得很奇怪,或者也许我实现了错误?也许很快就会发布任何改进?使用实现'com.google.android.ump:user-messaging-platform:2.1.0'
另外,如果用户已经同意,并且 Admob 设置从我的应用程序的个人广告更改为非个人广告,那么用户仍然会收到个人广告。
这是代码:
ConsentRequestParameters params = new ConsentRequestParameters
.Builder()
.setTagForUnderAgeOfConsent(false)
.build();
ConsentInformation consentInformation;
consentInformation = UserMessagingPlatform.getConsentInformation(this.getApplicationContext());
consentInformation.requestConsentInfoUpdate(
(Activity) 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()) {
// Loads a consent form. Must be called on the main thread.
UserMessagingPlatform.loadConsentForm(
MyActivity.this.getApplicationContext(),
new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
@Override
public void onConsentFormLoadSuccess(ConsentForm consentForm) { …Run Code Online (Sandbox Code Playgroud) 我遵循了本指南https://developers.google.com/admob/ump/android/quick-start,我的代码如下所示:
private fun checkForConsent() {
/*
val debugSettings = ConsentDebugSettings.Builder(this)
.setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
.addTestDeviceHashedId("69887E2CBBE5346EC3B54A3FD207AB41")
.build()
val params = ConsentRequestParameters.Builder()
.setConsentDebugSettings(debugSettings)
.build()
*/
Log.d("adstuff", "check Consent")
val params = ConsentRequestParameters.Builder().build()
// Set tag for under age of consent. Here false means users are not under age
//Log.d("adstuff", params.isTagForUnderAgeOfConsent.toString())
consentInformation = UserMessagingPlatform.getConsentInformation(this)
//consentInformation.reset();
consentInformation.requestConsentInfoUpdate(
this,
params,
object : ConsentInformation.OnConsentInfoUpdateSuccessListener {
override fun onConsentInfoUpdateSuccess() {
// The consent information state was updated.
// You are now ready to check if a form is …Run Code Online (Sandbox Code Playgroud) 我已遵循文档中的指南并在我的应用程序中实现了 SDK。我在 Firebase 中收到以下崩溃报告。
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'c.d.b.c.e.d.y c.d.b.c.e.d.w1.c' on a null object reference
at com.google.android.gms.internal.consent_sdk.zzj.isConsentFormAvailable(zzj.java:13)
at [my_app_package].MainActivity$1.onConsentInfoUpdateSuccess(MainActivity.java:1035)
at com.google.android.gms.internal.consent_sdk.zzu.run(zzu.java:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:239)
at android.app.ActivityThread.main(ActivityThread.java:8142)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
Run Code Online (Sandbox Code Playgroud)
有人遇到同样的问题吗?
第一行被混淆了。我认为崩溃是因为内部 SDK 问题。有人知道如何解决这个问题吗?
使固定:
当我按照原样遵循指南时,我遇到了内存泄漏。因此,我将 getApplicationContext() 传递给 UserMessagingPlatform.getConsentInformation()。这就是应用程序崩溃的原因。相反,我传递了这个(活动上下文)。现在一切都很好。为避免内存泄漏,请在 onDestroy() 方法中将consentInformation 和consentForm 变量分配为null。这对我有用。