> 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/app-faq/control-notification-by-in-app-function.md).

# アプリ内独自の通知ON・OFF機能によってプッシュ通知送信を制御したい

端末設定のプッシュ通知許諾（`plugin_native_app_identify` の `subscribe` フィールド）によるプッシュ通知送信の制御に加えて、アプリ内独自の通知ON・OFF機能によるプッシュ通知送信の制御をしたい場合には、カスタムイベントの実装が必要です。

## カスタムイベントの実装例

アプリ内独自の通知ON・OFF機能には、「重要なお知らせ」「新着情報」などの設定が例として挙げられます。

### 「重要なお知らせ」の例

以下のようなタイミングで[attribute](https://support.karte.io/post/1X39NRwR0HXzCtigtRrbLJ)のイベント名で、任意のフィールドで設定状態を`Bool`型で送信してください。フィールド名については、[こちら](https://support.karte.io/post/44VkfBjO7JdRnDv9YOfbFB#2-0)に基づいて設定してください。

* アプリ起動時に「重要なお知らせ」の最新の状態を送信する
* 「重要なお知らせ」の通知設定がONになった時に、 `true` を送信する
* 「重要なお知らせ」の通知設定がOFFになった時に、 `false` を送信する

### 「新着情報」の例

以下のようなタイミングで[attribute](https://support.karte.io/post/1X39NRwR0HXzCtigtRrbLJ)のイベント名で、任意のフィールドで設定状態を`Bool`型で送信してください。フィールド名については、[こちら](https://support.karte.io/post/44VkfBjO7JdRnDv9YOfbFB#2-0)に基づいて設定してください。

* アプリ起動時に「新着情報」の最新の状態を送信する
* 「新着情報」の通知設定がONになった時に、 `true` を送信する
* 「新着情報」の通知設定がOFFになった時に、 `false` を送信する

## カスタムイベントを用いたプッシュ通知送信制御の例

端末設定のプッシュ通知許諾とアプリ内独自の通知ON・OFF機能のカスタムイベントによって、以下のようなプッシュ通知送信制御が例として挙げられます。

* 端末設定のプッシュ通知許諾の値
  * `plugin_native_app_identify.subscribe = true`
  * `plugin_native_app_identify.subscribe = false`
* アプリ内独自の通知ON・OFF機能のカスタムイベントの値
  * `true`
  * `false`

|                                                      | カスタムイベントの値が true | カスタムイベントの値 がfalse |
| ---------------------------------------------------- | ---------------- | ----------------- |
| **plugin\_native\_app\_identify.subscribeの値が true**  | 送信対象（送信可能）       | 送信対象でない（送信可能）     |
| **plugin\_native\_app\_identify.subscribeの値が false** | 送信対象でない（送信不可能）   | 送信対象でない（送信不可能）    |


---

# 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://app.developers.karte.io/app-faq/control-notification-by-in-app-function.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.
