Skip to content

Consent Screen

Consent screens are used in mobile apps to ask a user's permission before doing something, such as collecting information about the user.

Consent Screen

Definition

@Composable
fun ConsentScreen(
    consentType: String,
    consentScreenSettings: ConsentScreenSettings? = null,
    agreeButtonClickListener: ViewClickListener? = null,
    disagreeButtonClickListener: ViewClickListener? = null
) { ... }

data class ConsentScreenSettings(
    val consentType: String,
    val learnMoreUrl: String? = null,
    @StringRes val title: Int = R.string.consent_screen_title,
    @StringRes val description: Int = R.string.consent_screen_desc,
    @StringRes val learnMore: Int = R.string.consent_screen_learn_more,
    @StringRes val agreeButtonCaption: Int = R.string.label_allow,
    @StringRes val disagreeButtonCaption: Int = R.string.label_deny,
) : BaseScreenSettings

Example

ConsentScreen(consentType = ConsentType.USAGE.name,
    agreeButtonClickListener = { block(step_usage, true) },
    disagreeButtonClickListener = { block(step_usage, false) }
)

Last update: February 20, 2023