# Results

The Results module shows a screen summarizing the data captured during onboarding, including OCR fields, captured images, and identity scores. It returns an overall user score.

For an overview of this module and how it works, see [Show Results](https://developer.incode.com/docs/field-comparison).

How you use this module depends on your [integration pattern](https://developer.incode.com/docs/android-common-implementation-patterns#integration-patterns). 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](https://developer.incode.com/docs/android-run-flows-configured-online).

Results is not available in [Capture-Only Mode](https://developer.incode.com/docs/android-capture-only-sdk).

## Add Results

1. Add an [ID Scan](https://developer.incode.com/docs/android-id-scan) or [QR Scan](https://developer.incode.com/docs/android-qr-scan) module before Results. If you want to include [Selfie Scan](https://developer.incode.com/docs/android-selfie-scan) in your flow, add it before Results as well. Results depends on the data those earlier steps produce, and the SDK validates this ordering.&#x20;
2. Add the module with one of the `addResults` overloads:

   ```kotlin
   // Default fetch mode (ACCURATE)
   flowConfigBuilder.addResults()

   // Or choose how results are fetched
   flowConfigBuilder.addResults(IncodeWelcome.IDResultsFetchMode.FAST)
   ```
   ```java
   // Default fetch mode (ACCURATE)
   flowConfigBuilder.addResults();

   // Or choose how results are fetched
   flowConfigBuilder.addResults(IncodeWelcome.IDResultsFetchMode.FAST);
   ```

### Example

The example below adds ID Scan and Selfie Scan before Results, and reads the score and status from `onResultsShown()`.

```kotlin
val flowConfig = FlowConfig.Builder()
    .addID()
    .addSelfieScan()
    .addResults()
    .build()

IncodeWelcome.getInstance().startOnboarding(
    activity,
    flowConfig,
    object : IncodeWelcome.OnboardingListener() {
        override fun onResultsShown(userScoreResult: UserScoreResult) {
            val score = userScoreResult.overallScore
            val status = userScoreResult.overallStatus
        }
    }
)
```
```java
FlowConfig flowConfig = new FlowConfig.Builder()
        .addID()
        .addSelfieScan()
        .addResults()
        .build();

IncodeWelcome.getInstance().startOnboarding(
        activity,
        flowConfig,
        new IncodeWelcome.OnboardingListener() {
            @Override
            public void onResultsShown(UserScoreResult userScoreResult) {
                String score = userScoreResult.overallScore;
                ResultsStatus status = userScoreResult.overallStatus;
            }
        }
);
```

## Configuration Options

Results has no `Builder`. Its only option is the results fetch mode, passed to `addResults(...)`.

| Setting                       | Description                                                                                      |
| ----------------------------- | ------------------------------------------------------------------------------------------------ |
| `IDResultsFetchMode.ACCURATE` | Shows results only after all results are calculated, for greater precision. This is the default. |
| `IDResultsFetchMode.FAST`     | Shows partial, less precise results sooner.                                                      |

For the complete option set, see `Results` and `IncodeWelcome.IDResultsFetchMode` in [API Reference](https://developer.incode.com/docs/android-api-reference).

## Result

Results delivers a `UserScoreResult` through the `onResultsShown(UserScoreResult)` callback on `IncodeWelcome.OnboardingListener`. Key fields include:

- `overallScore`: The overall score as a string; for example, `"80.5/100"`. `null` when unavailable.

- `overallStatus`: The overall result status (`ResultsStatus`); `null` when unavailable. One of the following:
  - `OK`: Passed.
  - `WARN`: Passed with warnings.
  - `FAIL`: Failed.
  - `UNKNOWN`: Status could not be determined.
  - `MANUAL`: Manual review needed.

- `idVerificationResults`: Results of all ID verification checks (`IdVerificationResults`); `null` when unavailable.

- `livenessCheckResults`: Results of the liveness checks (`LivenessCheckResults`); `null` when unavailable.

- `facialRecognitionResults`: Results of the facial recognition checks (`FacialRecognitionResults`); `null` when unavailable.

- `governmentValidationResults`: Results of the government validation checks (`GovernmentValidationResults`); `null` when unavailable.

- `extendedUserScoreJsonData`: Additional score data as key/value pairs; may be empty.

- 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.

If the module fails, the error surfaces through `OnboardingListener.onError(Throwable)`. This module does not deliver a module-specific exception subtype.

For all fields, see `UserScoreResult` in [API Reference](https://developer.incode.com/docs/android-api-reference).
