Skip to content
/ CMP Public

Consent Management Platform (CMP) compliant with Google's EU user consent policy for an Android application.

Notifications You must be signed in to change notification settings

epegasus/CMP

Repository files navigation

CMP

Google Consent Management Platform

Step 1

private val consentManager by lazy { ConsentManager(this) }

Step 2

when (BuildConfig.DEBUG) {
    true -> consentManager.initDebugConsent(onConsentResponse = onConsentResponse)
    false -> consentManager.initReleaseConsent(onConsentResponse = onConsentResponse)
}

Step 3

private val onConsentResponse = object : OnConsentResponse {
    override fun onResponse(errorMessage: String?) {
        errorMessage?.let {
            Log.e("TAG", "onResponse: Error: $it")
        }
        loadAds()
    }

    override fun onPolicyRequired(isRequired: Boolean) {
        Log.d("TAG", "onPolicyRequired: Is-Required: $isRequired")
    }
}

Sample Video

Recording.mp4

Releases

No releases published

Packages

No packages published

Languages