> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/android-sdk/inicializacion/lanzamiento-simplificado.md).

# Simplified Launch

## Initialize the SDK <a href="#id-22-inicializar-el-sdk" id="id-22-inicializar-el-sdk"></a>

The SDK works through a **main controller (`SDKController`)**. Facephi will provide the `apiKey` license required for initialization.

```kotlin
val sdkConfig = SdkConfigurationData(
    sdkApplication = SdkApplication(application),
    licensing = LicensingOnline(EnvironmentLicensingData(
            apiKey = "...")
      )),
)

val result = SDKController.initSdk(sdkConfig)

when (result) {
  is SdkResult.Success -> Log.d("APP: INIT SDK: OK")
  is SdkResult.Error -> Log.d(
          "APP: INIT SDK: KO - ${result.error.name}"
        )
}

if (BuildConfig.DEBUG) {
    SDKController.enableDebugMode()
}
```

## Start operation <a href="#id-23-iniciar-operacion" id="id-23-iniciar-operacion"></a>

Before launching any component, it is mandatory **start an operation**.

This method has the following input parameters:

1. **operationType**: Indicates whether an ONBOARDING or AUTHENTICATION process will be performed.
2. **customerId**: User identifier (controlled at application level).
3. **steps**: List of operation steps if they have been defined previously.
4. **enableTracking**: Indicates whether the operation should send Tracking events. By default it is `true`.

```kotlin
val result = SDKController.newOperation(
        operationType = OperationType.ONBOARDING,
        customerId = "customer_id",
        steps = listOf(Step.SELPHI_COMPONENT, Step.SELPHID_COMPONENT),
        enableTracking = true)
when (result) {
    is SdkResult.Success -> {
        Timber.d("APP: NEW OPERATION OK")
        Timber.d("Session ID: ${result.data.sessionId}")
        Timber.d("Operation ID: ${result.data.operationId}")
    }
    is SdkResult.Error -> {
        Timber.d("APP: NEW OPERATION ERROR: ${result.error.name}")
    }
}
```

When the operation is created successfully, `result.data` contains a `OperationResult` with `sessionId`, `operationId`, `type` and `customerId`. These values identify the session and the active operation, and can be used for traceability or to link subsequent calls with the platform.

{% hint style="info" %}
If the creation of a new operation returns an error of type **INTERNAL\_ERROR** it is mainly due to a **security**. To investigate the cause, it is possible to retrieve the Token associated with the error, which provides additional information for analysis.

```
if (result.error is SdkError.INTERNAL_ERROR){
    val token = (result.error as SdkError.INTERNAL_ERROR).error
}
```

{% endhint %}

## Component launch <a href="#id-24-lanzamiento-de-los-componentes" id="id-24-lanzamiento-de-los-componentes"></a>

Each component has its own controller and is launched from `SDKController`.

```kotlin
val result = SDKController.launch(ExampleController(ConfigurationData()))
when (result) {
    is SdkResult.Success -> {
        //Result OK
        result.data
    }
    is SdkResult.Error -> {
        //Result KO
        result.error.name
    }
}
```

The result of `launch` maintains the common structure `SdkResult`: in `Success`, `data` contains the output specific to the launched component; in `Error`, `error` contains the specific error of the component or the SDK.

***

## Security <a href="#id-24-lanzamiento-de-los-componentes" id="id-24-lanzamiento-de-los-componentes"></a>

The Android SDK includes a security system designed to detect and block potentially untrusted environments or those that may indicate attack attempts.<br>

This mechanism is enabled by default, allows identifying situations that could compromise security, and prevents the SDK from running in contexts that are not considered secure:

```
SDKController.securityMode(enable: Boolean) 
```

***
