I have an issue with AdMob's new 'Consent SDK'; the integration guide says to put the following into 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.
}
});
...
}
...
}
And then make a call to:
ConsentInformation.getInstance(context).isRequestLocationInEeaOrUnknown()
The problem I'm having is that when the app is first installed/launched, isRequestLocationInEeaOrUnknown() always returns 'false' (I am in the EEA by the way).
If I then exit the app and re-launch it, it returns 'true' - this is correct. If I then go into my device settings and perform a 'clear data' on my app and re-launch it, once again it returns 'false'.
Obviously this is worrying as I am showing my own custom consent dialog to EEA/Swizerland users than I am the ROW. And this needs to happen on first launch.
Interestingly, I tried putting the call to isRequestLocationInEeaOrUnknown() in my AsyncTask' doInBackground method (I kick this ASync off in onCreate) and then it does return 'true' on first-launch as do calls to it made in the ASync's 'onPostExecute' method. It's just that calls made to it in onCreate do not (before or after the Async starts).
I know it's early days, but has anyone stumbled upon similar issues with this?
You must call
isRequestLocationInEeaOrUnknown()
afteronConsentInfoUpdated
callback is called.This value is retrieved asynchronously by
requestConsentInfoUpdate()
, so it is not correct at first launch, but it is then cached so on second launch you have correct value.Since i faced the same issue, and the docks are a bit confusing I will try to explain how it works.
add this for testing only remove them in production and make sure you add them before you request consent
Request consent status like this:
I face the same, some countries are correct, some aren't. I tried "https://adservice.google.com/getconfig/pubvendors" too