我关注文档admob sdk,但是当我用vpn欧洲测试应用程序时,我弹出的不像弹出文档中没有显示是或否或付费广告
这是我的代码:
ConsentInformation consentInformation = ConsentInformation.getInstance(getApplicationContext());
String[] publisherIds = {""};
consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() {
@Override
public void onConsentInfoUpdated(ConsentStatus consentStatus) {
// User's consent status successfully updated.
boolean inEEA = ConsentInformation.getInstance(getApplicationContext()).isRequestLocationInEeaOrUnknown();
if(inEEA){
Toast.makeText(Splash.this,consentStatus.toString(),Toast.LENGTH_SHORT).show();
if (consentStatus==consentStatus.PERSONALIZED ||consentStatus==consentStatus.NON_PERSONALIZED )
{
Bundle extras = new Bundle();
extras.putString("npa", "1");
AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
.build();
}else {
URL privacyUrl = null;
try {
// TODO: Replace with your app's privacy policy URL.
privacyUrl = new URL("");
} catch (MalformedURLException e) {
e.printStackTrace();
// Handle error.
}
form = new ConsentForm.Builder(Splash.this, privacyUrl)
.withListener(new ConsentFormListener() {
@Override
public void onConsentFormLoaded() {
// Consent form loaded successfully.
form.show();
}
@Override
public void onConsentFormOpened() {
// Consent form was displayed.
}
@Override
public void onConsentFormClosed(
ConsentStatus consentStatus, Boolean userPrefersAdFree) {
// Consent form was closed.
Bundle extras = new Bundle();
extras.putString("npa", "1");
AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
.build();
}
@Override
public void onConsentFormError(String errorDescription) {
// Consent form error.
}
})
.withPersonalizedAdsOption()
.withNonPersonalizedAdsOption()
.withAdFreeOption()
.build();
form.load();
}
}else {
}
}
@Override
public void onFailedToUpdateConsentInfo(String errorDescription) {
// User's consent status failed to update.
}
});