UmpConsentController

Overview

Handles Google UMP (User Messaging Platform) consent flow. It determines whether the app can request ads, surfaces a privacy options entry point when required, and supports debug forcing EEA and test devices in development builds.

Platform

  • Enabled on Android by default (#define UMP_ENABLED when UNITY_ANDROID).
  • Skips execution in the Unity Editor (no mobile webview).

Atoms / Events

  • BoolReference adsCanRequestAds — set to true only when UMP reports we can request ads.
  • BoolReference privacyOptionsRequiredtrue when the SDK requires a privacy options entry point.
  • VoidEvent privacyOptionsRequested — call to open privacy options from a Settings button.

Dev / Test

  • forceEeaInDev — force EEA geography (dev builds only).
  • umpTestDeviceHashedIds — register hashed device IDs for UMP testing.
  • resetConsentEachDevBoot — call ConsentInformation.Reset() on dev boot (for QA only).

Behavior

  1. StartConsentFlow on app boot (outside Editor):
    • Build ConsentRequestParameters (not a kids app).
    • In dev: optionally register debug devices and force EEA.
    • Call ConsentInformation.Update(...) then ConsentForm.LoadAndShowConsentFormIfRequired(...).
  2. On consent form dismissal, updates:
    • adsCanRequestAds = ConsentInformation.CanRequestAds()
    • privacyOptionsRequired from ConsentInformation.PrivacyOptionsRequirementStatus.
  3. ShowPrivacyOptions() opens the UMP privacy options form if required and refreshes both atoms on close.

Threading

  • Marshals SDK callbacks back to the Unity main thread using SynchronizationContext.