> For the complete documentation index, see [llms.txt](https://documentation.pushly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.pushly.com/pushly-ja/integration/implementation-steps/react-native/sdk-react-native/dpurinku.md).

# ディープリンク

PushSDK は、通知の開封を次の方法で処理します:

#### Android

* デフォルトでは、SDK は自動的に新しい `ACTION_VIEW` インテントを、通知に添付されたランディング URL を使用して作成します。

#### iOS

* デフォルトでは、SDK は自動的に次を呼び出します `open` メソッドを、通知に添付されたランディング URL を使用して呼び出します。

次を実装する場合 `onPushSDKDidReceiveNotificationDestination` ライフサイクルコールバックを実装すると、通知が開かれたときに必要な任意のカスタムロジックを実行できます。

## URL 処理コールバックの実装

PushSDK は、購読者が通知を操作したときに呼び出されるコールバックを提供します。これらのコールバックは、通知を開いた後に購読者が適切なアクティビティへ自動的に遷移するよう実装する必要があります。

{% hint style="danger" %}
すべての SDK コールバックは、アプリケーションの `index.tsx` または `app.tsx` ファイル内に配置することを推奨します。これにより、すべての通知イベントを適切に処理できます。
{% endhint %}

SDK が通知の開封イベントを受信すると、アプリ内の適切なアクティビティへ購読者を遷移させるために使用できるパラメータを伴って、以下のいずれかのコールバックを呼び出そうとします。&#x20;

これらのコールバックを実装するには、SDK の `registerNotificationLifecycleCallbacks` メソッドを使用し、その中でコールバックを実装できます。

{% tabs %}
{% tab title="React" %}

```tsx
import PushSDK from '@pushly/push-sdk-react-native';

...
PushSDK.registerNotificationLifecycleCallbacks({
    // ここに関数のオーバーライドを追加
});
```

{% endtab %}
{% endtabs %}

たとえば、通知にランディング URL が添付されていて、購読者の遷移を処理するコールバックを実装した場合、コードは次のようになることがあります:

{% tabs %}
{% tab title="React" %}

```tsx
import PushSDK, { NotificationInteraction } from '@pushly/push-sdk-react-native';

...
PushSDK.registerNotificationLifecycleCallbacks({
    onPushSDKDidReceiveNotificationDestination(
        destination: string,
        interaction: NotificationInteraction
    ): boolean {
        // destination（ランディング URL）を使用して、アプリケーション内のアクティビティへ遷移する
        
        // SDK に対して遷移しないよう通知するために true を返す 
        return true;
    }
});
```

{% endtab %}
{% endtabs %}

## 通知インタラクションコールバック

### URI/URL 宛先付きで通知が開かれた場合

{% hint style="info" %}
添付されたランディング URL に対して、URL を直接開く方法では適切に処理できないカスタム解析や変更が必要な場合に、このコールバックを使用します。
{% endhint %}

このコールバックは、宛先のランディング URL が添付された通知が開かれたときに呼び出されます。購読者は、指定されたランディング URL を表すビューへ遷移する必要があります。

このメソッドは `boolean` の応答を想定しています。応答が `true` の場合、SDK はこの通知の開封に対して追加のアクションを実行しません。応答が `false` の場合、SDK は購読者を宛先 URL へ遷移させようとします。

{% tabs %}
{% tab title="React" %}

```tsx
onPushSDKDidReceiveNotificationDestination(
    destination: string,
    interaction: NotificationInteraction
): boolean {
    // destination（ランディング URL）を使用して、アプリケーション内のアクティビティへ遷移する
        
    // SDK に対して遷移しないよう通知するために true を返す 
    return true;
}
```

{% endtab %}
{% endtabs %}


---

# 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://documentation.pushly.com/pushly-ja/integration/implementation-steps/react-native/sdk-react-native/dpurinku.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.
