> For the complete documentation index, see [llms.txt](https://app.developers.karte.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://app.developers.karte.io/android-sdk-appendix/concepts-custom-url-scheme-android-sdk.md). Agents can also search and read this documentation through its [MCP server](https://app.developers.karte.io/~gitbook/mcp).

# \[Android]KARTE独自のカスタムURLスキームをハンドリングできるようにする

KARTE SDKでは、下記の各種機能に対応するために、カスタムURLスキームをハンドリングできるようにする設定が必要です。

* [Native機能呼び出し](https://support.karte.io/post/1F1VeY2yy3mrTIO2U4HhHi)
* [ビジュアルトラッキング](https://support.karte.io/post/7JbUVotDwZMvl6h3HL9Zt7)
* [アプリで確認](https://support.karte.io/post/3VsAULpSA8GmHwHXRHlB2O#2-7) の機能を使ったアクションのプレビュー

ここでは、カスタムURLスキームの設定方法について記載します。

※launchMode に "singleTop" などを指定したActivityではintentが更新されないため、カスタムURLスキームのハンドリングが正しく動作しない可能性があります。このような場合での対応方法については[再開されるActivityに対応する](https://app.developers.karte.io/android-sdk-appendix/appendix-relaunch-activity-android-sdk.md) をご確認ください。

## カスタムURLスキームを設定する

任意のエディタで `AndroidManifest.xml` を開き、下記設定を追記します。

{% code title="AndroidManifest.xml" overflow="wrap" %}

```xml
<activity
          android:name=".XxxActivity"
          android:theme="@style/Theme.AppCompat.NoActionBar">

  <!-- 任意のActivityに対して、以下の指定を行なってください -->
  <intent-filter >
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="krt-$(APIキー)" />
  </intent-filter>
</activity>
```

{% endcode %}

なお `$(APIキー)` の部分には、KARTEプロジェクト毎に用意されているAPIキーを指定します。

{% hint style="info" %}
**APIキーの確認方法**

APIキーは管理画面から取得可能です。\
詳細については、[こちら](https://support.karte.io/post/7bq63EfIXdTjcHXextXKBh)をご覧ください。
{% endhint %}

{% hint style="warning" %}
**間違いやすい点**

SDKの初期化に利用するアプリケーションキーとAPIキーは異なるものです。\
お間違えないようご注意ください。
{% endhint %}
