微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android 用户消息平台 isConsentFormAvailable 返回 false

如何解决Android 用户消息平台 isConsentFormAvailable 返回 false

我遵循了本指南 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 available.
                    Log.d("adstuff","Is consentform available")
                    Log.d("adstuff",consentinformation.isConsentFormAvailable.toString())

                    if (consentinformation.isConsentFormAvailable) {
                        Log.d("adstuff","Consentform is available")

                        loadForm()
                    }
                }
            },object : Consentinformation.OnConsentInfoUpdateFailureListener {
                override fun onConsentInfoUpdateFailure(formError: FormError) {
                    // Handle the error.
                    Log.d("adstuff","content info update failure")
                    Log.d("adstuff",formError.toString())

                }
            })
    }

但是,consentinformation.isConsentFormAvailable 返回 false。我创建了一个 AdMob 帐户和一个 Funding Choices 帐户,我在其中创建并发布了 Consent TCF 类型的消息。我还在 Android 清单中添加了 ca-app-pub ID。

谢谢

编辑:如果我使用调试设置将位置设置为 EEA,就像在注释代码中一样,同意信息更新将失败。

解决方法

在您的手机中,依次转到“设置”>“隐私”>“高级”>“广告”并关闭“选择退出广告个性化”

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。