我对 AdMob 的新“Consent SDK”有疑问;集成指南说将以下内容放入onCreate ...
public class MainActivity extends Activity {
...
@Override
protected void onCreate(Bundle savedInstanceState) {
...
ConsentInformation consentInformation = ConsentInformation.getInstance(context);
String[] publisherIds = {"pub-xxxxxxxxxxxxxxxx"};
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.
}
});
...
}
...
}
然后拨打电话:
ConsentInformation.getInstance(context).isRequestLocationInEeaOrUnknown()
我遇到的问题是,当应用程序首次安装/启动时,isRequestLocationInEeaOrUnknown()总是返回“false”(顺便说一句,我在EEA 中)。
如果我然后退出应用程序并重新启动它,它会返回“true” - 这是正确的。如果我然后进入我的设备设置并在我的应用程序上执行“清除数据”并重新启动它,它再次返回“假”。
显然,这令人担忧,因为我向 EEA/Swizerland 用户展示了我自己的自定义同意对话框,而不是 ROW。这需要在首次发布时发生。
有趣的是,我尝试在我的 AsyncTask 的doInBackground方法中调用isRequestLocationInEeaOrUnknown()(我在 onCreate 中关闭了这个 ASync),然后它在第一次启动时返回“true”,就像在 ASync 的“onPostExecute”中调用它一样方法。只是在 onCreate 中对其进行的调用不会(在异步启动之前或之后)。
我知道现在还为时尚早,但有没有人偶然发现过类似的问题?