Is it possible to get cached result of ConsentInformation.getPrivacyOptionsRequirementStatus from previous session?

98 views Asked by At

Background

I'm trying to work with the new SDK from Google to handle the GDPR ad-consent rules, and found some useful websites I've checked out, to handle not just a normal flow, but also query about things that don't exist in the SDK and handle some issues there as well :

The problem

The normal flow works fine. I query the current state (using requestConsentInfoUpdate), and if needed I show the UI to the user (using loadAndShowConsentFormIfRequired), and also offer a setting to reach there if that's also needed (using getPrivacyOptionsRequirementStatus and UserMessagingPlatform.showPrivacyOptionsForm).

Thing is, it sometimes takes some time for querying the current state (can take up to 3 seconds in my case), so I wanted to find how to use what's already cached instead.

What I've found

In order to reduce the time for query, I've found that the results are already saved, so instead of using ConsentInformation.canRequestAds I've found that I can reach the sharedPreferences as shown here, and that before everything, to make sure the cached data isn't expired, I tried to call what's shown here. These are all workarounds, so I requested to have something more official, here.

Only one thing left to avoid query using requestConsentInfoUpdate when all is cached already: getPrivacyOptionsRequirementStatus .

This function tells if I should offer the user to reach the UI of the ad-consent via the settings of the app.

The docs for it (here) actually say that I can already use it right away, getting the last session's result by default if it exists:

Returns ...UNKNOWN until requestConsentInfoUpdate(...) is called, and defaults to the previous session's value until requestConsentInfoUpdate(...) completes successfully and ...OnConsentInfoUpdateSuccessListener is called.

Sadly, when trying it out, it doesn't fulfil what the documentation says, so I've reported about this issue here.

The question

Is this saved somewhere? Can I fetch the cached boolean value for it? If so, how?

0

There are 0 answers