> 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/ja/implement-nfc-wallet/tokenize-a-card/set-cdcvm-method.md).

# CDCVM方式を設定する

## 概要

デジタルカードプロファイルは、CDCVM をサポートするかどうかを定義します。

特定のウォレットインスタンスでは、 **CDCVM をサポートする最初にプロビジョニングされたカードが** が定義する **CDCVM メソッド** によって使用される **デジタルウォレットアプリケーション**.

NFC Wallet SDK では、異なる CDCVM メソッドを持つカードを同一のウォレットインスタンス内で共存させることはできません。

で説明されているように [CDCVM の処理](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/handle-cdcvm.md)、ほとんどの NFC Wallet プログラムでは CDCVM を使用します。

このセクションでは、デバイスの機能に基づいて CDCVM メソッドを設定します。 **トークン化** CDCVM をサポートする最初のカードの

{% hint style="danger" %}
**CDCVM メソッドの設定が必要です**

プロファイルが CDCVM をサポートしており、CDCVM メソッドを設定しない場合:

* カード一覧の取得は次のエラーで失敗します: `DigitalizedCardErrorCodes.CD_CVM_REQUIRED`.
* CDCVM メソッドを設定するまで、NFC 支払いは失敗します。
  {% endhint %}

## SDK 連携

### CDCVM がサポートされているか確認し、設定する

使用する `CHVerificationManager` 現在のウォレットインスタンスで CDCVM がサポートされているか、すでに構成されているかを確認します:

* `CHVerificationManager.isFCDCVMSupported()` CDCVM がサポートされているかを確認します。
* `CHVerificationManager.isFCdCvmSet()` CDCVM メソッドがすでに設定されているかを確認します。
* `CHVerificationManager.getDefaultFCdCvm()` デジタルウォレットアプリケーションで使用される CDCVM メソッドを返します。

CDCVM がサポートされていて未設定の場合は、で説明されているように初期化します [CDCVM メソッドを設定する](#set-the-cdcvm-method).

### 処理 `CD_CVM_REQUIRED` カードを一覧表示する際に

CDCVM メソッドを設定せずに、次を使用してカード一覧を取得すると `DigitalizedCardManager.getAllCards()`、SDK は次を返す場合があります `DigitalizedCardErrorCodes.CD_CVM_REQUIRED`。その場合は、で説明されているように CDCVM メソッドを初期化します [CDCVM メソッドを設定する](#set-the-cdcvm-method).

```java
DigitalizedCardManager.getAllCards( new AbstractAsyncHandler<String[]> () {
    
    @Override
    public void onComplete(final AsyncResult<String[]> asyncResult) {
        if (asyncResult.isSuccessful()) {
            // カード一覧の取得に成功しました
        }
        else {
            // カード一覧の取得に失敗しました
            final int errorCode = asyncResult.getErrorCode();
            if (errorCode == DigitalizedCardErrorCodes.CD_CVM_REQUIRED) {
                // ここで CDCVM メソッドを設定します（次のセクションを参照）
                // ....
            }
        }
    }
    
});
```

### CDCVM メソッドを設定する

使用する `DeviceCVMManager.initialize(...）` デバイスの機能に応じて CDCVM メソッドを設定するには:

* **生体認証**: `CHVerificationMethod.BIOMETRICS`
* **デバイス認証情報（keyguard）**: `CHVerificationMethod.DEVICE_KEYGUARD`

{% hint style="info" %}
CDCVM メソッドを設定した後は、エンドユーザーがデバイスのロック解除方法を変更するシナリオを考慮してください。参照: [デバイスのロック解除方法の更新シナリオ](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/tokenize-a-card/set-cdcvm-method/device-unlock-method-update-scenarios.md).
{% endhint %}

#### 実装例

```java
// CDCVM に対するデバイスの有効性を確認
DeviceCVM有効性Result result =
        DeviceCVM有効性Checker.checkDeviceEligibility(getApplicationContext());

if (result.getBiometricsSupport() == BiometricsSupport.SUPPORTED) {
    // 生体認証がサポートされています
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.BIOMETRICS);
    } catch (DeviceCVMException e) {
        // エラーを処理する
    }
}
else if (result.getDeviceKeyguardSupport() == DeviceKeyguardSupport.SUPPORTED) {
    // 生体認証がサポートされていない場合は、デバイスの keyguard を使用します。
    try {
        DeviceCVMManager.INSTANCE.initialize(CHVerificationMethod.DEVICE_KEYGUARD);
    } catch (DeviceCVMException e) {
        // エラーを処理する
    }
}
else {
    // デバイスが CDCVM をサポートしていないか、エンドユーザーがセキュアなロック画面を有効にしていません。
    // エンドユーザーに生体認証またはデバイス認証情報を有効にするよう促します。
}
```


---

# 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/ja/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.
