gpt4 book ai didi

Android GDPR 同意书错误 : request is not in EEA or unknown

转载 作者:太空宇宙 更新时间:2023-11-03 12:02:52 25 4
gpt4 key购买 nike

我正在尝试为 GDPR 设置同意书,但该表格给我错误:请求不在 EEA 中或未知。我如何伪装自己位于 EEA 中的位置以便测试表格?我假设 ConsentInformation 类必须以某种方式获取我的 GPS 坐标,即使我已经尝试在手机和模拟器上运行它(两者的结果相同)。这是我的代码(与文档相同):

public class MainActivity extends AppCompatActivity {
ConsentForm form;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Timber.d(" *** Main Activity *** ");
getConsent();
showConsentForm();
}

public void getConsent() {
Timber.d ("Attempting to get consent");
ConsentInformation consentInformation = ConsentInformation.getInstance(this);
String[] publisherIds = {"pub-2153652996366584"};
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.
}
});
}

public void showConsentForm() {
Timber.d ("Building consent form");
URL privacyUrl = null;
try {
privacyUrl = new URL("https://www.your.com/privacyurl");
} catch (MalformedURLException e) {
Timber.e(e.getMessage());
}
form = new ConsentForm.Builder(this, privacyUrl)
.withListener(new ConsentFormListener() {
@Override
public void onConsentFormLoaded() {
Timber.d("Consent form loaded successfully.");
}

@Override
public void onConsentFormOpened() {
Timber.d("Consent form was displayed.");
}

@Override
public void onConsentFormClosed(
ConsentStatus consentStatus, Boolean userPrefersAdFree) {
Timber.d("Consent form was closed.");
}

@Override
public void onConsentFormError(String errorDescription) {
Timber.d("Consent form error:" + errorDescription);
}
})
.withPersonalizedAdsOption()
.withNonPersonalizedAdsOption()
.withAdFreeOption()
.build();
}

public void onConsentLoadClick(View view) {
Timber.d("Loading the Consent Form");
form.load();
}

public void onConsentShowClick(View view) {
Timber.d("Showing the consent form");
form.show();
}

最佳答案

根据谷歌 https://developers.google.com/admob/android/eu-consent在“测试”部分下,他们提供了有关如何为 EEA 以外的用户进行测试的说明。

希望这对您有所帮助!

// Geography appears as in EEA for test devices.
ConsentInformation.getInstance(context).
consentInformation.addTestDevice("XXXXXXXXXXXXXXXXXXXXX");
consentInformation.setDebugGeography(DebugGeography.DEBUG_GEOGRAPHY_EEA);

编辑:您还必须将您的设备添加为测试设备才能使其正常工作。初始化许可库后,您设备的测试 ID 将显示在 Logcat 中。

关于Android GDPR 同意书错误 : request is not in EEA or unknown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50649577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com