gpt4 book ai didi

android - 在许可 SDK admob 中为个性化广告添加 npa 0 是否有效?

转载 作者:行者123 更新时间:2023-12-03 16:50:35 25 4
gpt4 key购买 nike

我希望你一切都好。

在 bundle 中添加 npa 0 以请求个性化广告是否有效,或者我们需要为此创建另一个对象?

根据文档这里所说的 Forward consent to the Google Mobile Ads SDK

这是请求非个性化广告

Bundle extras = new Bundle();
extras.putString("npa", "1");
AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, extras)
.build();

根据文档,它说:

If non-personalized ads are requested, the ad request URL currently includes &npa=1. However, note that this is an internal implementation detail of the Google Mobile Ads SDK and is subject to change.



如果我想请求个性化广告,我可以输入 0?
Bundle extras = new Bundle();extras.putString("npa", "0");

提前致谢

最佳答案

如果您想请求个性化广告,则无需使用addNetworkExtrasBundle() .

只需使用,

AdRequest.Builder builder = new AdRequest.Builder();
if (/*Request non-personalized ads*/) {
Bundle extras = new Bundle();
extras.putString("npa", "1");
builder.addNetworkExtrasBundle(AdMobAdapter.class, extras);
}
AdRequest request = builder.build();

关于android - 在许可 SDK admob 中为个性化广告添加 npa 0 是否有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58371241/

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