> 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/merchant-tokenization/ja/sdk-tong-he/integration/android.md).

# Android

このガイドを使用して、を統合します **Thales SDK** Android マーチャントアプリケーションに。

### 配布パッケージ <a href="#delivery-packages" id="delivery-packages"></a>

SDK配布パッケージには以下が含まれます:

| 名前                                              | 説明                         |
| ----------------------------------------------- | -------------------------- |
| tmgsdk-debug-`<version>`-`<release_date>`.aar   | Thales SDK のデバッグ用 AAR。     |
| tmgsdk-release-`<version>`-`<release_date>`.aar | Thales SDK のリリース用 AAR。     |
| demo                                            | SDK の統合と使用方法を示すサンプルプロジェクト。 |
| javadoc                                         | SDK API ドキュメント。            |

### 依存関係 <a href="#dependencies" id="dependencies"></a>

<table><thead><tr><th width="100">依存関係名</th><th width="100">バージョン</th><th>説明</th></tr></thead><tbody><tr><td>JNA</td><td>5.5.0</td><td>このライブラリは Thales SDK に同梱されたネイティブライブラリへアクセスするために使用されます。</td></tr><tr><td>AndroidX Biometric</td><td>1.1.0</td><td>このライブラリは Android デバイスでの生体認証に使用されます。</td></tr></tbody></table>

{% hint style="warning" %}
SDK v2.0.0 以降、OkHttp はもはや必須ではありません。
{% endhint %}

### SDKを統合する <a href="#application-integration" id="application-integration"></a>

1. というフォルダを作成します `libs` プロジェクトディレクトリの下。

<figure><img src="/files/0a0b37a95b0da2dc1da5e2306f2162838f9b04ae" alt=""><figcaption><p>例 <code>libs</code> SDK AAR を含むフォルダ。</p></figcaption></figure>

2. コピー `tmgsdk-<variant>-<version>-<release_date>.aar` へ `libs` フォルダ。

   `variant` は `debug` または `release`.
3. を開いてください `app/build.gradle` ファイルを開き、以下の依存関係を追加してください：

```java
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'net.java.dev.jna:jna:5.5.0@aar'
implementation fileTree(dir: 'libs', include: ['*.aar'])
```

### SDKを構成する <a href="#sdk-configuration" id="sdk-configuration"></a>

{% hint style="warning" %}

* SDK v2.0.0 以降、アプリケーションは証明書の PIN 値を提供する必要がなくなりました。
* SDK v3.0.0 以降、SDK は Android Keyguard をサポートしなくなりました。
  {% endhint %}

SDKのいかなるAPIを呼ぶ前にもThales SDKを構成してください。

を作成します `TMGClientConfiguration` 必要なパラメータで:

* アプリケーションコンテキスト
* サーバーURL
* サーバー証明書
* キー識別子

#### 1. を作成します `TMGClientConfiguration`

オンボーディング中にサーバーURL、サーバー証明書、およびキー識別子を取得します。

```java
Activity activity;
String serverUrl;
byte[] serverCertificate;
String keyIdentifier;
TMGClientConfiguration tmgClientConfiguration = new TMGClientConfiguration(activity, 
                                                                           serverUrl, 
                                                                           serverCertificate, 
                                                                           keyIdentifier);
```

#### 2. 生体認証サポートの確認

デバイスが生体認証をサポートしているか確認します。

```java
int biometricSupport = DeviceAuthenticationChecker.getBiometricsSupport(activity);
if (biometricSupport == BiometricsSupport.SUPPORTED) {
    // 現在のデバイスは生体認証をサポートしています。
}
```

#### 3. を作成します `VisaCTFHelper`

Visa CTFおよびDAFのデバイスバインディング開始とトランザクション認証のためのヘルパーを作成します。

```java
public void initVisaCTFHelper(@NonNull TMGClientConfiguration tmgClientConfiguration) {
    byte[] password = this.getUserPassword();
        VisaCTFHelper visaCTFHelper = TMGClient.getInstance().createVisaCTFHelper(tmgClientConfiguration);
    } catch (TMGClientException e) {
        // エラーを処理します。
    }
}
```

#### 4. 作成する `MastercardTAFHelper`

Mastercard TAFのデバイスバインディング開始とトランザクション認証のためのヘルパーを作成します。

```java
public void initMastercardTAFHelper(@NonNull TMGClientConfiguration tmgClientConfiguration) {
   byte[] password = this.getUserPassword();
       MastercardTAFHelper mastercardTAFHelper = TMGClient.getInstance().createMastercardTAFHelper(tmgClientConfiguration);
   } catch (TMGClientException e) {
       // エラーを処理します。
   }
}
```


---

# 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/merchant-tokenization/ja/sdk-tong-he/integration/android.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.
