> For the complete documentation index, see [llms.txt](https://developer.aliothx.net/start/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.aliothx.net/start/common/index/push-message.md).

# 푸시 메시지

### 푸시 메시지 생성 과정

푸시 메시지를 관리하기 위한 핵심 단계는 다음과 같습니다.

1. **토큰 정보 확인**: 앱과 구글 파이어베이스를 연동하여 사용자별 토큰 정보를 생성하고 서버에 저장합니다.
2. **푸시 메시지 전송**: 서버에서 사용자별 토큰 정보를 활용하여 푸시 메시지를 전송합니다.
3. **인앱 메시지 전송**: 앱 내에서 푸시 메시지와 연계하여 사용자에게 인앱 메시지를 전송합니다.

### 1. 토큰 정보 확인

![](/files/IQ4PVN8VqhJedwxhcTWy)

푸시 메시지를 전송하려면 먼저 사용자별 토큰 정보를 확인해야 합니다. 이 토큰은 각 사용자를 고유하게 식별하며, 서버에서 푸시 메시지를 전송할 때 사용됩니다.

```dart
 onPressed: () async {
                  final prefs = await SharedPreferences.getInstance();
                  var token = prefs.getString("token");
                  flutterToast.info(message: token ?? "");
                }
```

* **"토큰정보" 버튼 클릭**: 이 버튼을 클릭하면 현재 앱에서 사용 중인 토큰 정보를 확인할 수 있습니다. 토큰 정보는 구글 파이어베이스와 연동하여 생성됩니다.

### 2. 푸시 메시지 전송

토큰 정보를 확인한 후, 서버에서 푸시 메시지를 전송할 수 있습니다. 이 메시지는 사용자의 디바이스로 전송되어 푸시 알림으로 표시됩니다.

* **"푸시 메시지 전송" 버튼 클릭**: 이 버튼을 클릭하면 서버에서 푸시 메시지를 전송하는 기능이 활성화됩니다. 이를 통해 사용자에게 메시지를 전달할 수 있습니다.

### 3. 인앱 메시지 전송

푸시 메시지와 함께, 앱 내에서도 인앱 메시지를 사용하여 사용자에게 정보를 전달할 수 있습니다.

* **"인앱 메시지 전송" 버튼 클릭**: 이 버튼을 클릭하면 앱 내에서 인앱 메시지를 전송하는 기능이 활성화됩니다. 이를 통해 사용자에게 앱 내에서 메시지를 표시할 수 있습니다.

푸시 메시지와 인앱 메시지를 효과적으로 활용하여 사용자와 상호작용하고 앱의 사용성을 향상시킬 수 있습니다.

이제 Flutter 앱에서 푸시 메시지를 관리하는 방법을 알게 되었습니다. 이러한 기능을 활용하여 사용자 경험을 향상시키고 필요한 정보를 효과적으로 전달할 수 있습니다.


---

# 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://developer.aliothx.net/start/common/index/push-message.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.
