# Name

The Name module collects the user's name and sends it to the server.

There is no Dashboard equivalent for this module, so you cannot use [integration Pattern 3](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-3-run-flows-configured-in-dashboard) to add it. You must use [Pattern 1](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-1-configure-flows-locally-and-run-end-to-end) or [2](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-2-configure-flows-locally-and-run-step-by-step), adding the module to a `FlowConfig` in code as shown on this page.

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

## Add Name

Add the module with `addName()`.

```kotlin
flowConfigBuilder.addName()
```
```java
flowConfigBuilder.addName();
```

### Example

The example below adds Name as the only step in the flow and listens for the result through `onAddNameCompleted()`.

```kotlin
val flowConfig = FlowConfig.Builder()
    .addName()
    .build()

val onboardingListener = object : OnboardingListener() {
    override fun onAddNameCompleted(nameResult: NameResult) {
        // Name captured. Process the result.
    }
}

IncodeWelcome.getInstance()
    .startOnboarding(activityContext, sessionConfig, flowConfig, onboardingListener)
```
```java
FlowConfig flowConfig = new FlowConfig.Builder()
    .addName()
    .build();

IncodeWelcome.OnboardingListener onboardingListener = new IncodeWelcome.OnboardingListener() {
    @Override
    public void onAddNameCompleted(@NonNull NameResult nameResult) {
        // Name captured. Process the result.
    }
};

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

## Configuration Options

Name has no configurable options. It has no `Builder`, so you add it with the no-argument `addName()` method.

## Result

Name delivers a `NameResult` to the `onAddNameCompleted(NameResult)` callback on the `OnboardingListener`. Key fields include:

- `name`: The name captured from the user; `null` when unavailable.
- 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 surface via `OnboardingListener.onError(Throwable)`. This module does not deliver a module-specific exception subtype.

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