googleads-consent-sdk-android icon indicating copy to clipboard operation
googleads-consent-sdk-android copied to clipboard

Bug: ConsentData.isRequestLocationInEeaOrUnknown is initialized to false

Open frevds opened this issue 6 years ago • 2 comments

ConsentInformation.isRequestLocationInEeaOrUnknown returns false if requestConsentInfoUpdate was 1) not called or 2) did not succeed.

This is because ConsentData.isRequestLocationInEeaOrUnknown is set to false in its constructor, which is plainly wrong, as it is unknown at this moment.

frevds avatar Jun 02 '18 12:06 frevds

I don't think this is a bug. If you look at https://developers.google.com/admob/android/eu-consent#update_consent_status it says:

Once consent information is successfully updated, you can also check ConsentInformation.getInstance(context).isRequestLocationInEeaOrUnknown() to see if the user is located in the European Economic Area or the request location is unknown.

In other words you shouldn't call isRequestLocationInEeaOrUnknown() unless you're inside onConsentInfoUpdated(). That's what I do, and it appears to work fine.

I agree the docs/code snippets could be clearer on this.

cacti77 avatar Oct 10 '18 17:10 cacti77

This affected me as well. I followed the documentation to show a consent form only if isRequestLocationInEeaOrUnknown. While debugging I use setDebugLocation to confirm the form will show without errors. Even right after calling setDebugLocation it was always false until requestConsentInfoUpdate was called. Interestingly though, setDebugLocation does work at any point in my Activity, given you only use isRequestLocationInEeaOrUnknown as @cacti77 has mentioned above.

Funmungus avatar Oct 24 '19 01:10 Funmungus