SDK reference · Android SDK / Android Individual Modules

User Consent

The User Consent module shows a custom consent agreement for the user to review and accept. Use it to capture an explicit, recorded agreement at a chosen point in the flow. The consent step records acceptance against the current onboarding session; the exact downstream behavior depends on your Incode Flow or Workflow configuration.

There is no Dashboard equivalent for this module, so you cannot use integration Pattern 3 to add it. You must use Pattern 1 or 2, adding the module to a FlowConfig in code as shown on this page.

{/* PM: True? No Dashboard equivalent? */}

For acceptance of multiple statements on one screen, see Combined Consent. For biometric or machine learning data consent, see Machine Learning Consent.

  1. Add the module with addUserConsent(userConsent).

    flowConfigBuilder.addUserConsent(userConsent)
    
    flowConfigBuilder.addUserConsent(userConsent);
    
  1. Add any Approval or Results modules after User Consent.

Example

The example below builds a UserConsent module with a title and body, adds it to a FlowConfig with a flow tag, and starts an onboarding section.

try {
    val userConsent = UserConsent.Builder()
        .setTitle("Terms and conditions")
        .setContent("I agree to the terms and conditions.")
        .build()

    val flowConfig = FlowConfig.Builder()
        .setFlowTag("User consent section")
        .addUserConsent(userConsent)
        .build()

    IncodeWelcome.getInstance()
        .startOnboardingSection(activityContext, flowConfig, object : OnboardingListener() {
            override fun onUserConsentCompleted() {
                // User accepted the consent
            }

            override fun onError(error: Throwable) {}

            override fun onUserCancelled() {}

            override fun onOnboardingSectionCompleted(flowTag: String) {
                // User consent section complete
            }
        }
    )
} catch (e: ModuleConfigurationException) {
    e.printStackTrace()
}
try {
    UserConsent userConsent = new UserConsent.Builder()
        .setTitle("Terms and conditions")
        .setContent("I agree to the terms and conditions.")
        .build();

    FlowConfig flowConfig = new FlowConfig.Builder()
        .setFlowTag("User consent section")
        .addUserConsent(userConsent)
        .build();

    IncodeWelcome.getInstance()
        .startOnboardingSection(activityContext, flowConfig, new IncodeWelcome.OnboardingListener() {
            @Override
            public void onUserConsentCompleted() {
                // User accepted the consent
            }

            @Override
            public void onError(@NonNull Throwable error) {}

            @Override
            public void onUserCancelled() {}

            @Override
            public void onOnboardingSectionCompleted(@NonNull String flowTag) {
                // User consent section complete
            }
        }
    );
} catch (ModuleConfigurationException e) {
    e.printStackTrace();
}

Configuration Options

Configure the module with UserConsent.Builder. The table below lists the common options.

Setting Description
setTitle(String) Sets the heading shown above the consent body text.
setContent(String) Sets the consent body text the user reviews and accepts or rejects.

For the complete option set, see UserConsent.Builder in API Reference.

Result

User Consent does not deliver a result payload to the OnboardingListener. The onUserConsentCompleted() callback signals that the user accepted the consent. If the user rejects the consent, the onUserCancelled() callback fires instead. Any failure surfaces on onError(Throwable).


For the related result type and its fields, see UserConsentResult in API Reference.

Was this page helpful?