admin管理员组文章数量:1024670
I've implemented CMP "a certified consent management platform (CMP)".according to admob request, I followed google implementation here: But I am still getting error from admob console "Some ad requests on your inventory from the EEA, the UK, or Switzerland are missing a TC string"
Main activity code as below:
googleMobileAdsConsentManager =
GoogleMobileAdsConsentManager.getInstance(getApplicationContext());
googleMobileAdsConsentManager.gatherConsent(
this,
consentError -> {
if (consentError != null) {
// Consent not obtained in current session.
}
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
if (googleMobileAdsConsentManager.isPrivacyOptionsRequired()) {
// Regenerate the options menu to include a privacy setting.
invalidateOptionsMenu();
}
});
// This sample attempts to load ads using consent obtained in the previous session.
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
Anny suggestion?
I've implemented CMP "a certified consent management platform (CMP)".according to admob request, I followed google implementation here: But I am still getting error from admob console "Some ad requests on your inventory from the EEA, the UK, or Switzerland are missing a TC string"
Main activity code as below:
googleMobileAdsConsentManager =
GoogleMobileAdsConsentManager.getInstance(getApplicationContext());
googleMobileAdsConsentManager.gatherConsent(
this,
consentError -> {
if (consentError != null) {
// Consent not obtained in current session.
}
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
if (googleMobileAdsConsentManager.isPrivacyOptionsRequired()) {
// Regenerate the options menu to include a privacy setting.
invalidateOptionsMenu();
}
});
// This sample attempts to load ads using consent obtained in the previous session.
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
Anny suggestion?
Share Improve this question asked Nov 18, 2024 at 14:05 صلي علي محمد - Atef Faroukصلي علي محمد - Atef Farouk 4,2972 gold badges37 silver badges56 bronze badges1 Answer
Reset to default 0After user grants or declines the Ads Personalisation request a key is stored in Shared preferences Automatically.
Shared preference Key name :- IABTCF_TCString
String tcString;
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
tcString = sp.getString("IABTCF_TCString", "Key not found");
Pass in AdMob
AdRequest adRequest = new AdRequest.Builder()
.addNetworkExtrasBundle(NativeAd.class, createAdMobExtras(tcString)) // Passing TC string
.build();
private Bundle createAdMobExtras(String tcString) {
Bundle extras = new Bundle();
extras.putString("tcString", tcString); // Pass the TC string using the correct key
return extras;
}
I've implemented CMP "a certified consent management platform (CMP)".according to admob request, I followed google implementation here: But I am still getting error from admob console "Some ad requests on your inventory from the EEA, the UK, or Switzerland are missing a TC string"
Main activity code as below:
googleMobileAdsConsentManager =
GoogleMobileAdsConsentManager.getInstance(getApplicationContext());
googleMobileAdsConsentManager.gatherConsent(
this,
consentError -> {
if (consentError != null) {
// Consent not obtained in current session.
}
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
if (googleMobileAdsConsentManager.isPrivacyOptionsRequired()) {
// Regenerate the options menu to include a privacy setting.
invalidateOptionsMenu();
}
});
// This sample attempts to load ads using consent obtained in the previous session.
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
Anny suggestion?
I've implemented CMP "a certified consent management platform (CMP)".according to admob request, I followed google implementation here: But I am still getting error from admob console "Some ad requests on your inventory from the EEA, the UK, or Switzerland are missing a TC string"
Main activity code as below:
googleMobileAdsConsentManager =
GoogleMobileAdsConsentManager.getInstance(getApplicationContext());
googleMobileAdsConsentManager.gatherConsent(
this,
consentError -> {
if (consentError != null) {
// Consent not obtained in current session.
}
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
if (googleMobileAdsConsentManager.isPrivacyOptionsRequired()) {
// Regenerate the options menu to include a privacy setting.
invalidateOptionsMenu();
}
});
// This sample attempts to load ads using consent obtained in the previous session.
if (googleMobileAdsConsentManager.canRequestAds()) {
initializeMobileAdsSdk();
}
Anny suggestion?
Share Improve this question asked Nov 18, 2024 at 14:05 صلي علي محمد - Atef Faroukصلي علي محمد - Atef Farouk 4,2972 gold badges37 silver badges56 bronze badges1 Answer
Reset to default 0After user grants or declines the Ads Personalisation request a key is stored in Shared preferences Automatically.
Shared preference Key name :- IABTCF_TCString
String tcString;
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
tcString = sp.getString("IABTCF_TCString", "Key not found");
Pass in AdMob
AdRequest adRequest = new AdRequest.Builder()
.addNetworkExtrasBundle(NativeAd.class, createAdMobExtras(tcString)) // Passing TC string
.build();
private Bundle createAdMobExtras(String tcString) {
Bundle extras = new Bundle();
extras.putString("tcString", tcString); // Pass the TC string using the correct key
return extras;
}
本文标签:
版权声明:本文标题:android - Some ad requests on your inventory from the EEA, the UK, or Switzerland are missing a TC string, admob error - Stack O 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745612107a2159064.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论