Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
FCM dựa vào bộ thành phần sau đây để tạo, truyền tải và nhận thông báo:
Công cụ để soạn hoặc tạo yêu cầu nhắn tin. Trình soạn thảo Thông báo cung cấp một lựa chọn dựa trên GUI để tạo các yêu cầu thông báo.
Để tự động hoá hoàn toàn và hỗ trợ tất cả các loại thông báo, bạn phải tạo yêu cầu thông báo trong một môi trường máy chủ đáng tin cậy hỗ trợ Firebase Admin SDK hoặc giao thức máy chủ FCM.
Môi trường này có thể là Cloud Functions cho Firebase, App Engine hoặc máy chủ ứng dụng của riêng bạn.
Phần phụ trợ FCM (trong số các chức năng khác) chấp nhận các yêu cầu về thông báo, thực hiện việc truyền tin nhắn qua các chủ đề và tạo siêu dữ liệu thông báo, chẳng hạn như mã nhận dạng thông báo.
Một lớp truyền tải ở cấp nền tảng, định tuyến thông báo đến thiết bị mục tiêu, xử lý việc gửi thông báo và áp dụng cấu hình dành riêng cho nền tảng khi thích hợp. Lớp truyền tải này bao gồm:
Lớp truyền tải Android (ATL) cho các thiết bị Android có Dịch vụ Google Play
Dịch vụ thông báo đẩy của Apple (APNs) cho các thiết bị Apple
Giao thức thông báo đẩy trên web cho ứng dụng web
FCM SDK trên thiết bị của người dùng, nơi thông báo được hiển thị hoặc thông báo được xử lý theo trạng thái nền trước/nền của ứng dụng và mọi logic ứng dụng có liên quan.
Luồng vòng đời
Đăng ký thiết bị để nhận tin nhắn từ FCM. Một phiên bản của ứng dụng khách đăng ký nhận thông báo, nhận được một mã thông báo đăng ký xác định duy nhất phiên bản ứng dụng.
Gửi và nhận thông báo truyền tin.
Gửi thư. Máy chủ ứng dụng gửi thông báo đến ứng dụng khách:
Thông báo được soạn trong trình soạn thảo Thông báo hoặc một môi trường đáng tin cậy, sau đó yêu cầu thông báo sẽ được gửi đến phần phụ trợ FCM.
Phần phụ trợ FCM nhận yêu cầu thông báo, tạo mã thông báo và siêu dữ liệu khác, rồi gửi yêu cầu đó đến lớp truyền tải dành riêng cho nền tảng.
Khi thiết bị đang kết nối mạng, thông báo sẽ được gửi đến thiết bị thông qua tầng truyền tải dành riêng cho nền tảng.
Trên thiết bị, ứng dụng nhận được thông báo hoặc tin nhắn.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-05 UTC."],[],[],null,["\u003cbr /\u003e\n\nFCM relies on the following set of components that build, transport, and receive\nmessages:\n\n1. Tooling to compose or build message requests. The Notifications composer\n provides a GUI-based option for creating notification requests.\n For full automation and support for all\n [message types](https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages),\n you must build message requests in a trusted\n [server environment](https://firebase.google.com/docs/cloud-messaging/server)\n that supports the Firebase Admin SDK or the FCM server protocol.\n This environment could be Cloud Functions for Firebase, App Engine,\n or your own app server.\n\n2. The FCM backend, which (among other functions) accepts message requests,\n performs fanout of messages via topics, and generates message metadata such\n as the message ID.\n\n3. A platform-level transport layer, which routes the message to the targeted\n device, handles message delivery, and applies platform-specific\n configuration where appropriate. This transport layer includes:\n\n - Android transport layer (ATL) for Android devices with Google Play services\n - Apple Push Notification service (APNs) for Apple devices\n - Web push protocol for web apps\n\n | **Note:** Platform-level transport layers are outside the core FCM product. FCM messages routed to a platform-level transport layer may be subject to terms specific to that platform rather than FCM's terms of service. Android message routing via ATL falls under the [Google APIs terms of service](https://www.google.com/url?q=https://developers.google.com/terms/&sa=D&ust=1558536676246000&usg=AFQjCNFrlRMLv51d1S9NkWxD0IoYSqJ2Ng).\n4. The FCM SDK on the user's device, where the notification is displayed or\n the message is handled according to the app's foreground/background state\n and any relevant application logic.\n\nLifecycle flow\n\n- **Register devices to receive messages from FCM**. An instance of a client app registers to receive messages, obtaining a registration token that uniquely identifies the app instance.\n- **Send and receive downstream messages** .\n - Send a message. The app server sends messages to the client app:\n 1. The message is composed, either in the Notifications composer or a trusted environment, and a message request is sent to the FCM backend.\n 2. The FCM backend receives the message request, generates a message ID and other metadata, and sends it to the platform specific transport layer.\n 3. When the device is online, the message is sent via the platform-specific transport layer to the device.\n 4. On the device, the client app receives the message or notification."]]