【问题标题】:I get errors when I'm trying to add the gdpr code尝试添加 gdpr 代码时出现错误
【发布时间】:2019-11-12 02:27:26
【问题描述】:

当我尝试添加 gdpr 代码时,我遇到了这个错误,我尝试了一些方法,但我仍然遇到同样的问题,如果有人可以提供帮助,我将不胜感激。

// TODO: Replace with your app's privacy policy URL.
        privacyUrl = new URL("https://www.your.com/privacyurl");
    } catch (MalformedURLException e) {
        e.printStackTrace();
        // Handle error.
    }
    ConsentForm form = new ConsentForm.Builder(context, privacyUrl)
            .withListener(new ConsentFormListener() {
                @Override
                public void onConsentFormLoaded() {
                    // Consent form loaded successfully.
                }

                @Override
                public void onConsentFormOpened() {
                    // Consent form was displayed.
                }

【问题讨论】:

  • 是否导入了同意书?您还可以提供错误日志/跟踪吗?谢谢。

标签: java android admob-cookieconsent


【解决方案1】:

将依赖添加到模块的build.gradle:

// Google AdMob, EU Cookie Consent
implementation ("com.google.android.ads.consent:consent-library:1.0.7") {
    // exclude group: "com.google.code.gson"
}

进口是:

import com.google.ads.consent.AdProvider;
import com.google.ads.consent.ConsentForm;
import com.google.ads.consent.ConsentFormListener;
import com.google.ads.consent.ConsentInfoUpdateListener;
import com.google.ads.consent.ConsentInformation;
import com.google.ads.consent.ConsentStatus;
import com.google.ads.consent.DebugGeography;

【讨论】:

  • Martin Zeitler 我添加了它,但仍然有相同的上下文是红色的
  • @taylerfand 也添加了导入。
猜你喜欢
  • 2013-10-18
  • 2013-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-21
  • 2018-05-01
相关资源
最近更新 更多