java - 我无法在 java gpdr 协议上加载表单
问题描述
也许您知道有必要在 android https://developers.google.com/mobile-ads-sdk/docs/dfp/android/eu-consent中添加此协议表格
onCreate
我在方法的上方添加了这段代码main_activity.java
ConsentInformation consentInformation = ConsentInformation.getInstance(this);
String[] publisherIds = {"pub-123"};
ConsentInformation.getInstance(this)
.setConsentStatus(ConsentStatus.PERSONALIZED);
ConsentInformation.getInstance(this).
setDebugGeography(DebugGeography.DEBUG_GEOGRAPHY_EEA);
handler = new Handler();
consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() {
@Override
public void onConsentInfoUpdated(ConsentStatus consentStatus) {
// User's consent status successfully updated.
}
@Override
public void onFailedToUpdateConsentInfo(String errorDescription) {
// User's consent status failed to update.
}
});
URL privacyUrl = null;
try {
// TODO: Replace with your app's privacy policy URL.
privacyUrl = new URL("https://www.123.com/privacy");
} catch (MalformedURLException e) {
e.printStackTrace();
// Handle error.
}
ConsentForm form = new ConsentForm.Builder(this, privacyUrl)
.withListener(new ConsentFormListener() {
@Override
public void onConsentFormLoaded() {
// Consent form loaded successfully.
}
@Override
public void onConsentFormOpened() {
// Consent form was displayed.
}
@Override
public void onConsentFormClosed(
ConsentStatus consentStatus, Boolean userPrefersAdFree) {
// Consent form was closed.
}
@Override
public void onConsentFormError(String errorDescription) {
// Consent form error.
}
})
.withPersonalizedAdsOption()
.withNonPersonalizedAdsOption()
.withAdFreeOption()
.build();
form.load();
form.show();
但是当我打开应用程序进行测试时,表单不会加载。问题可能出在哪里。我假设,这条线: DEBUG_GEOGRAPHY_EEA
<<定义手机的位置,但我什么也没看到
谢谢你的时间 !
解决方案
推荐阅读
- php - Laravel 预期状态码 200 但收到 500
- java - 写出用户输入中大写字符的数量
- flutter - Dart:const 类还是 const var?
- json - 如何使用管道和过滤器使用角度 HttpClient 服务从 json 文件中获取数据?
- machine-learning - 在 RNN 模型上计算 TIMIT 数据集的准确性
- django - Django RF - 带有 ModelViewSet 的嵌套序列化程序
- ruby - 正在使用的 ruby 版本是否确定使用哪个 openssl 版本,以及是否可以使用 TLS 版本?
- php - PHP $_GET 参数给出问题
- regex - Matlab:查找字符串模式并将其替换为随机字符串
- postgresql - 42P07:关系“AspNetRoles”已经存在