> 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

## Resumen

El perfil de tarjeta digital define si admite CDCVM.

Para una instancia de cartera dada, 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 coexistán tarjetas con diferentes métodos CDCVM en la misma instancia de cartera.

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

En esta sección, estableces el método CDCVM en función de las capacidades del dispositivo durante **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 establece

Use `CHVerificationManager` para comprobar si CDCVM es compatible y ya está configurado para la instancia de cartera 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 [Configura el método CDCVM](#set-the-cdcvm-method).

### Gestiona `CD_CVM_REQUIRED` al listar las 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 ese caso, inicializa el método CDCVM como se describe en [Configura 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()) {
            // Lista de tarjetas recuperada correctamente
        }
        else {
            // Falló la recuperación de la lista de tarjetas
            final int errorCode = asyncResult.getErrorCode();
            if (errorCode == DigitalizedCardErrorCodes.CD_CVM_REQUIRED) {
                // Configura aquí el método CDCVM (consulta la siguiente sección)
                // ....
            }
        }
    }
    
});
```

### Configura el método CDCVM

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

* **Biometría**: `CHVerificationMethod.BIOMETRICS`
* **Credenciales del dispositivo (keyguard)**: `CHVerificationMethod.DEVICE_KEYGUARD`

{% hint style="info" %}
Después de configurar el método CDCVM, considera 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 biometría es compatible
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.BIOMETRICS);
    } catch (DeviceCVMException e) {
        // Manejar error
    }
}
else if (result.getDeviceKeyguardSupport() == DeviceKeyguardSupport.SUPPORTED) {
    // Si la biometría no es compatible, usa el keyguard del dispositivo.
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.DEVICE_KEYGUARD);
    } catch (DeviceCVMException e) {
        // Manejar 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.
