> 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/manage-digital-cards/display-digital-cards.md).

# デジタルカードを表示する

## 概要

が完了した後、 **トークナイゼーション**、あなたの **デジタルウォレットアプリケーション** は次を表示する必要があります **エンドユーザー** 彼らのデジタルカード。

リストビューと詳細ビューを提供してください。

UIを駆動するためにカードのステータス、カードデザイン、およびメタデータを使用してください。

## SDK の統合

### 使用する `DigitalizedCardManager` <a href="#digitalizedcardmanager" id="digitalizedcardmanager"></a>

が完了した後、 **トークナイゼーション** が完了すると、使用します `DigitalizedCardManager` にアクセスして **NFCウォレットSDK** 永続データを取得しデジタルカードを取得します。

`DigitalizedCardManager` は非同期およびブロッキング呼び出しをサポートします：

* `AsyncHandler`：コールバックを介して結果を受け取ります。
* `AsyncToken`：操作が完了するまで呼び出し元スレッドをブロックします。

{% hint style="warning" %}
`AsyncToken` は呼び出し元スレッドをブロックします。UIスレッドでは避けてください。
{% endhint %}

### カード一覧を取得する

が完了した後、 **トークナイゼーション** が完了すると、使用します `DigitalizedCardManager.getAllCards()` を使用してすべての **トークナイズされたカードIDを取得します**.

識別子の違いについては、参照してください [トークナイズされたカードIDとデジタルカードIDの違い](#tokenized-card-id-versus-digital-card-id).

以下の例は、でトークナイズされたカードIDを取得する方法を示します `AsyncHandler` と `AsyncToken`.

{% tabs %}
{% tab title="AsyncHandler" %}
{% code title="AsyncHandlerを使用してトークナイズされたカードIDを取得する" %}

```java
// UIスレッドでの処理を避けるためにHandlerThreadをインスタンス化します。
HandlerThread cardDisplayThread = new HandlerThread("getAllCards");
cardDisplayThread.start();

Looper looper = cardDisplayThread.getLooper();

AbstractAsyncHandler<String[]> handler = new AbstractAsyncHandler<String[]>(looper) {
    @Override
    public void onComplete(AsyncResult<String[]> result) {
        if (result.isSuccessful()) {
            String[] tokenizedCardIds = result.getResult();
            // TODO: カードを表示する
        } else {
            // TODO: エラーを処理する
        }
    }
};

DigitalizedCardManager.getAllCards(handler);
```

{% endcode %}
{% endtab %}

{% tab title="AsyncToken" %}
{% code title="AsyncToken（ブロッキング）を使用してトークナイズされたカードIDを取得する" %}

```java
AsyncToken<String[]> token = DigitalizedCardManager.getAllCards(null);
AsyncResult<String[]> result = token.waitToComplete();

if (result.isSuccessful()) {
    String[] tokenizedCardIds = result.getResult();
    // TODO: カードを表示する
} else {
    // TODO: エラーを処理する
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### トークナイズされたカードIDとデジタルカードIDの違い <a href="#tokenized-card-id-versus-digital-card-id" id="tokenized-card-id-versus-digital-card-id"></a>

`DigitalizedCardManager` 一覧化してカードを取得します、使用して **トークン化されたカードID**.

`DigitalizedCard.getTokenizedCardID()` はを返します **トークナイズされたカードID。**

この識別子はと同じではありません **デジタルカードID**.

{% hint style="warning" %}
The **NFCウォレットSDK** は同じカードに対して2つの識別子を使用します：

* **トークナイズされたカードID**：セキュアプロビジョニング中に生成されます。CPSトークンIDとも呼ばれます。参照してください [プロビジョニングをトリガーする](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/tokenize-a-card/trigger-provisioning.md).
* **デジタルカードID**：デジタル化中に生成されます。MGカードIDとも呼ばれます。参照してください [カードをデジタル化する](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/tokenize-a-card/digitize-a-card.md).
  {% endhint %}

識別子を変換するためにこれらのヘルパーメソッドを使用してください：

* `DigitalizedCardManager.getDigitalCardId()`：トークナイズされたカードIDからデジタルカードIDを取得します。
* `DigitalizedCardManager.getTokenizedCardId()`：デジタルカードIDからトークナイズされたカードIDを取得します。

{% hint style="info" %}
TSPは独自のデジタルカード識別子も提供します。

でそれを取得します [カードメタデータ](#card-metadata).

TSP（VTS/MDES）とトラブルシューティングする際に使用してください。

この識別子はトークナイズされたカードIDおよびデジタルカードIDとは異なります。
{% endhint %}

### デジタルカード情報を取得する

#### 使用する `DigitalizedCard`

`DigitalizedCard` はデジタル化されたカードを表し、次のようなカードデータを公開します：

* `DigitalizedCardStatus`
  * カードの状態： `ACTIVE`, `SUSPENDED`
  * 支払いキーのステータス：補充の必要性を検出するために使用します。
* `DigitalizedCardDetails`
  * FPANの下4桁
  * DPANの下4桁
  * FPANの有効期限
  * 支払いネットワーク（Visa、Mastercard、PURE）

共ブランドかどうかを確認するには次を使用します `DigitalizedCard.hasAuxiliaryScheme()`.

を取得する `DigitalizedCard` から `DigitalizedCardManager` を使用して **トークン化されたカードID**.

#### カードメタデータ

使用する `MGCardEnrollmentService.getCardMetaData()` および **デジタルカードID** を使用して、次のようなカードメタデータを取得します：

* TSP イシュア名
* TSP ID（VTS、MDES、または別の識別子）
* PAR（支払いアカウント参照）
* TSP デジタルカードID（`tokenId`)

完全なフィールドのカバレッジについては、SDK APIリファレンスを参照してください。

{% hint style="info" %}
TSP デジタルカードID（`tokenId`）は次にマップされます：

* Mastercard（MDES）： `tokenUniqueReference`
* Visa（VTS）： `tokenReferenceID`
  {% endhint %}

#### カードアート

使用する `MobileGatewayManager.getCardArt()` および **デジタルカードID** を使用して取得します `CardArt`.

使用する `CardArt.getBitmap()` を使用してカード画像を取得します：

* `BANK_LOGO`：イシュアのロゴ
* `CARD_BACKGROUND`：カードの背景
* `CARD_BACKGROUND_COMBINED`：支払いネットワークと組み合わせたカードの背景
* `CARD_ICON`：カードアイコン

{% hint style="warning" %}
カードアートの取得はネットワークリクエストをトリガーします。画像はにキャッシュしてください **デジタルウォレットアプリケーション**.
{% endhint %}

サンプルアプリケーションはシンプルなローカルキャッシュ手法を示します：

{% code title="カードアートをローカルにキャッシュする" %}

```java
public void getCardArt(final Context context, final String digitalCardId) {
    // まずローカルに画像が既にあるかを確認します。
    final byte[] imageBytes = readFromFile(context, digitalCardId);

    if (imageBytes.length > 0) {
        final Drawable image = new BitmapDrawable(
                context.getResources(),
                BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length)
        );
        // TODO: 画像を返す
        return;
    }

    // バックエンドからカードアートデータをダウンロードします。
    final MobileGatewayManager gatewayManager = MobileGatewayManager.INSTANCE;
    try {
        final CardArt cardArt = gatewayManager.getCardArt(digitalCardId);
        cardArt.getBitmap(
                CardArtType.CARD_BACKGROUND_COMBINED,
                new AsyncHandlerCardBitmap(new AsyncHandlerCardBitmap.Delegate() {
                    @Override
                    public void onSuccess(final CardBitmap value) {
                        // 将来の使用のために現在のデータを保存します。
                        writeToFile(context, digitalCardId, value.getResource());

                        final Drawable image = new BitmapDrawable(
                                context.getResources(),
                                BitmapFactory.decodeByteArray(value.getResource(), 0, value.getResource().length)
                        );
                        // TODO: 画像を返す
                    }

                    @Override
                    public void onError(final String error) {
                        // TODO: エラーをログに記録する
                    }
                })
        );
    } catch (final NoSuchCardException exception) {
        // TODO: エラーをログに記録する
    }
}
```

{% endcode %}


---

# 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:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/ja/implement-nfc-wallet/manage-digital-cards/display-digital-cards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
