ConsentController

Controls the consent lifecycle via Google's User Messaging Platform (UMP). Call requestConsentInfoUpdate on every app launch and gatherConsent to show the consent form when required. Gate ad requests on canRequestAds.

Properties

Link copied to clipboard
abstract val canRequestAds: StateFlow<Boolean>

True when ads may be requested based on the current consent state.

Link copied to clipboard

Whether privacy options must be shown to the user.

Link copied to clipboard
abstract val status: StateFlow<ConsentStatus>

Current UMP consent status (ConsentStatus).

Functions

Link copied to clipboard
abstract suspend fun gatherConsent(config: AdConfig): ConsentStatus

Requests an update and shows the consent form if required.

Link copied to clipboard
abstract suspend fun requestConsentInfoUpdate(config: AdConfig): ConsentStatus

Requests a consent info update from UMP. Call every app launch.

Link copied to clipboard
abstract suspend fun resetConsentForDebug(): Boolean

Resets consent state for debug/testing purposes only.

Link copied to clipboard
abstract suspend fun showPrivacyOptions(): Boolean

Shows the privacy options form. Should only be called when privacyOptionsRequirementStatus is PrivacyOptionsRequirementStatus.Required.