> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/es/implement-nfc-wallet/tokenize-a-card/set-cdcvm-method.md).

# Establecer el método CDCVM

## Descripción general

El perfil de la tarjeta digital define si admite CDCVM.

Para una instancia de wallet determinada, la **primera tarjeta aprovisionada que admite CDCVM** define el **método CDCVM** utilizado por la **aplicación de cartera digital**.

NFC Wallet SDK no permite que coexistan tarjetas con diferentes métodos CDCVM en la misma instancia de wallet.

Como se describe en [Gestionar CDCVM](/nfc-wallet-sdk-android/es/implement-nfc-wallet/handle-cdcvm.md), la mayoría de los programas de NFC Wallet utilizan CDCVM.

En esta sección, configuras el método CDCVM según las capacidades del dispositivo durante **la tokenización** de la primera tarjeta que admite CDCVM.

{% hint style="danger" %}
**Configurar el método CDCVM es obligatorio**

Si el perfil admite CDCVM y no configuras el método CDCVM:

* La recuperación de la lista de tarjetas falla con `DigitalizedCardErrorCodes.CD_CVM_REQUIRED`.
* Los pagos NFC fallan hasta que configures el método CDCVM.
  {% endhint %}

## Integración del SDK

### Comprueba si CDCVM es compatible y configúralo

Usa `CHVerificationManager` para comprobar si CDCVM es compatible y ya está configurado para la instancia de wallet actual:

* `CHVerificationManager.isFCDCVMSupported()` comprueba si CDCVM es compatible.
* `CHVerificationManager.isFCdCvmSet()` comprueba si el método CDCVM ya está configurado.
* `CHVerificationManager.getDefaultFCdCvm()` devuelve el método CDCVM utilizado por la aplicación de cartera digital.

Si CDCVM es compatible y no está configurado, inicialízalo como se describe en [Configurar el método CDCVM](#set-the-cdcvm-method).

### Gestionar `CD_CVM_REQUIRED` al listar tarjetas

Si no configuras el método CDCVM y recuperas la lista de tarjetas usando `DigitalizedCardManager.getAllCards()`, el SDK puede devolver `DigitalizedCardErrorCodes.CD_CVM_REQUIRED`. En tal caso, inicializa el método CDCVM como se describe en [Configurar el método CDCVM](#set-the-cdcvm-method).

```java
DigitalizedCardManager.getAllCards( new AbstractAsyncHandler<String[]> () {
    
    @Override
    public void onComplete(final AsyncResult<String[]> asyncResult) {
        if (asyncResult.isSuccessful()) {
            // La lista de tarjetas se recuperó correctamente
        }
        else {
            // La recuperación de la lista de tarjetas falló
            final int errorCode = asyncResult.getErrorCode();
            if (errorCode == DigitalizedCardErrorCodes.CD_CVM_REQUIRED) {
                // Configura aquí el método CDCVM (consulta la siguiente sección)
                // ....
            }
        }
    }
    
});
```

### Configurar el método CDCVM

Usa `DeviceCVMManager.initialize(...)` para configurar el método CDCVM según las capacidades del dispositivo:

* **Biométrico**: `CHVerificationMethod.BIOMETRICS`
* **Credenciales del dispositivo (keyguard)**: `CHVerificationMethod.DEVICE_KEYGUARD`

{% hint style="info" %}
Después de configurar el método CDCVM, considera los escenarios en los que el usuario final cambia el método de desbloqueo del dispositivo. Consulta [Escenario de actualización del método de desbloqueo del dispositivo](/nfc-wallet-sdk-android/es/implement-nfc-wallet/tokenize-a-card/set-cdcvm-method/device-unlock-method-update-scenarios.md).
{% endhint %}

#### Ejemplo de implementación

```java
// Comprueba la elegibilidad del dispositivo para CDCVM
DeviceCVMEligibilityResult result =
        DeviceCVMEligibilityChecker.checkDeviceEligibility(getApplicationContext());

if (result.getBiometricsSupport() == BiometricsSupport.SUPPORTED) {
    // La opción biométrica es compatible
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.BIOMETRICS);
    } catch (DeviceCVMException e) {
        // Gestionar el error
    }
}
else if (result.getDeviceKeyguardSupport() == DeviceKeyguardSupport.SUPPORTED) {
    // Si la biometría no es compatible, usa la credencial del dispositivo.
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.DEVICE_KEYGUARD);
    } catch (DeviceCVMException e) {
        // Gestionar el error
    }
}
else {
    // El dispositivo no admite CDCVM, o el usuario final no habilitó una pantalla de bloqueo segura.
    // Pide al usuario final que habilite la biometría o las credenciales del dispositivo.
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/es/implement-nfc-wallet/tokenize-a-card/set-cdcvm-method.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
