Sharing following code, how am I calling for CMP dialog.
fun initDebugConsent(deviceId: String, onConsentResponse: OnConsentResponse) {
this.onConsentResponse = onConsentResponse
val debugSettings = ConsentDebugSettings.Builder(activity)
.setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
.addTestDeviceHashedId(deviceId)
.build()
val params = ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build()
requestConsentInfo(params)
}
private fun requestConsentInfo(params: ConsentRequestParameters) {
consentInformation.requestConsentInfoUpdate(activity, params, {
if (consentInformation.isConsentFormAvailable && consentInformation.consentStatus == ConsentInformation.ConsentStatus.REQUIRED) {
Log.d("ConsentManager", "initDebugConsent: Available & Required")
loadForm()
} else {
Log.d("ConsentManager", "initDebugConsent: Neither Available or Required")
onConsentResponse?.onResponse()
}
}, { error ->
Log.e("ConsentManager", "initDebugConsent: $error")
onConsentResponse?.onResponse(error.message)
})
}
Note: It do show first time, but after consent I have to wait a lot for again testing.
I got by resetting
consentInformationobject only indebugmode, as it is recommended by google team.