Table of Contents

Class ConsentModule

Namespace
Titipi.MocaLib2

Owns the user-privacy consent that must be resolved before any third-party SDK is initialized: iOS App Tracking Transparency (ATT), and — on the AdMob path — the Google UMP consent flow (GDPR/TCF) that Google's EU user consent policy requires before the first ad request. Always available — no define guard required.

public static class ConsentModule
Inheritance
ConsentModule
Inherited Members

Properties

CanRequestAds

Whether the gathered consent permits requesting ads. Only meaningful once RequestUmpConsentAsync() has completed — before that it is false, because ads must not be requested until the user has answered. Always true in builds without UMP (no AdMob module, or AppLovin's own consent flow is the CMP), where nothing here gates ad requests.

IsPrivacyOptionsRequired

Whether the user's region entitles them to reopen the consent form from your settings UI. When true, you must expose an entry point that calls ShowPrivacyOptionsFormAsync(). Only meaningful once RequestUmpConsentAsync() has completed; always false in builds without UMP.

IsTrackingAuthorized

Whether the user permits tracking (IDFA access). Only meaningful once RequestATTrackingAsync() has completed. true on platforms where ATT does not apply.

Methods

EnableConsentDebugging(ConsentDebugGeography, List<TestDevice>)

Makes UMP treat this device as if it were in geography, so the consent form can be exercised from a region that would not otherwise show one. Call before RequestUmpConsentAsync(), in development builds only — remove before shipping.

RequestATTrackingAsync()

Requests iOS ATT authorization. When the Facebook module is enabled, also forwards the outcome to the Meta Audience Network SDK, which cannot read the ATT status on its own. Await this before initializing any SDK that reads the IDFA (Firebase, AppLovin, AppsFlyer, Adjust…): unlike a fire-and-forget request it does not return until the user has answered, so those SDKs start up with the final tracking state instead of racing the prompt. Returns true when tracking is authorized. Returns true without prompting on non-iOS platforms and on iOS below 14.5, where ATT does not exist and tracking is permitted by default.

RequestUmpConsentAsync()

Runs the Google UMP consent flow: refreshes the stored consent state, then shows the consent form if the user's region requires one. Returns whether ads may now be requested (CanRequestAds). Await this before AdMobModule.InitializeAsync — Google's EU user consent policy requires the user to have answered before the first ad request. Awaiting it early, while a loading screen is still up, also keeps the form from appearing on top of gameplay. Safe to await more than once: the flow runs once per launch (as UMP requires) and later callers get that same result. Returns true immediately in builds without UMP, so callers need no guard.

ResetConsent()

Clears the stored UMP consent, so the next RequestUmpConsentAsync() gathers it from scratch and shows the form again. Testing only — never ship a call to this. Leaves CanRequestAds false until that next call completes.

ShowPrivacyOptionsFormAsync()

Reopens the UMP privacy options form so the user can change or withdraw the consent they already gave. Call this from a settings entry point, which is mandatory whenever IsPrivacyOptionsRequired is true. Returns whether the form was shown. The user may withdraw consent here, so CanRequestAds can be false once this returns — stop requesting new ads in that case.