SDK reference · Android SDK / Android Individual Modules

Government Validation

The Government Validation module validates identity data extracted from a user's ID against an authoritative government registry. The process runs in the background and isn't visible to the user. It can also match the user's photo in the government database against their captured selfie. Whether the validation runs and what it checks also depend on your Incode Flow or Workflow configuration.

For an overview of this module and how it works, see Government Data Verification and Government Record Verification.

How you use this module depends on your integration pattern. In Patterns 1 and 2, you add the module to a FlowConfig in code as shown on this page. In Pattern 3, you define your modules and configuration in Dashboard as a Flow or Workflow and reference it by ID with startFlow() or startWorkflow() as shown on Run Flows Configured in Dashboard.

Government Validation is not available in Capture-Only mode; adding it there throws ModuleNotAvailableException.

Add Government Validation

  1. Add an ID Scan or QR Scan module, and a Selfie Scan module, before Government Validation. Government Validation depends on these earlier capture steps so there is document data and a face to validate.

  2. Add the module with one of the addGovernmentValidation overloads:

    // Default configuration
    flowConfigBuilder.addGovernmentValidation()
    
    // Custom configuration
    flowConfigBuilder.addGovernmentValidation(governmentValidation)
    
    // Default configuration
    flowConfigBuilder.addGovernmentValidation();
    
    // Custom configuration
    flowConfigBuilder.addGovernmentValidation(governmentValidation);
    

Example

The example below adds ID Scan and Selfie Scan before Government Validation, builds a GovernmentValidation module with the animation shown, and listens for the result through onGovernmentValidationCompleted().

val governmentValidation = GovernmentValidation.Builder()
    .setSkipAnimation(false)
    .build()

val flowConfig = FlowConfig.Builder()
    .addID()
    .addSelfieScan()
    .addGovernmentValidation(governmentValidation)
    .build()

val onboardingListener = object : IncodeWelcome.OnboardingListener() {
    override fun onGovernmentValidationCompleted(success: Boolean) {
        // Government validation completed; success indicates whether it passed
    }

    override fun onError(error: Throwable) {
        // Onboarding flow was aborted due to error
    }
}

IncodeWelcome.getInstance().startOnboarding(
    activityContext,
    sessionConfig,
    flowConfig,
    onboardingListener
)
GovernmentValidation governmentValidation = new GovernmentValidation.Builder()
    .setSkipAnimation(false)
    .build();

FlowConfig flowConfig = new FlowConfig.Builder()
    .addID()
    .addSelfieScan()
    .addGovernmentValidation(governmentValidation)
    .build();

IncodeWelcome.OnboardingListener onboardingListener = new IncodeWelcome.OnboardingListener() {
    @Override
    public void onGovernmentValidationCompleted(boolean success) {
        // Government validation completed; success indicates whether it passed
    }

    @Override
    public void onError(@NonNull Throwable error) {
        // Onboarding flow was aborted due to error
    }
};

IncodeWelcome.getInstance().startOnboarding(
    activityContext,
    sessionConfig,
    flowConfig,
    onboardingListener
);

Configuration Options

Configure the module with GovernmentValidation.Builder. The table below lists the one option it exposes.

Setting Description
setSkipAnimation Sets whether the animation that plays in this module is skipped. true skips it, false plays it. Default is false.

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

Result

Government Validation does not return a result payload object to the integrator. The flow signals completion through the onGovernmentValidationCompleted(success) callback on OnboardingListener. Key fields include:

  • isSuccess: true if government validation completed successfully; otherwise, false.
  • Fields inherited from BaseResult:
    • resultCode: The ResultCode for this result.
    • error: When resultCode is ERROR, the Throwable that caused it; otherwise, null.
    • deviceStats: The DeviceStats snapshot of the device state when the result was produced.
    • motionStatus: Device motion assessment during capture. One of the following:
      • UNCLEAR: Motion could not be determined; the default.
      • PASS: Device motion was within acceptable limits.
      • FAIL: Excessive device motion was detected.

Errors are not delivered through this callback. If the flow is aborted, for example due to a network failure or an unavailable module, the error surfaces via OnboardingListener.onError(Throwable). There is no module-specific exception subtype for Government Validation.

For the related API surface, see GovernmentValidation in API Reference.

Was this page helpful?