Check out what’s new from Firebase at Google I/O 2022.
Learn more
FCM 架构概览
FCM 依赖于以下一组组件来构建、传输和接收消息:
用于编写或构建消息请求的工具。通知编辑器提供了一种基于 GUI 的用于创建通知请求的方式。
要实现对所有消息类型的完全自动化和支持,您必须在支持 Firebase Admin SDK 或 FCM 服务器协议的受信任服务器环境中构建消息请求。
此环境可以是 Cloud Functions for Firebase、App Engine 或您自己的应用服务器。

FCM 后端(以及其他函数),它接受消息请求,通过主题对消息执行扇出,并生成消息 ID 等消息元数据。
平台级传输层,用于将消息路由到目标设备、处理消息传送,并在适当情况下应用针对具体平台的配置。此传输层包括:
- Android 传输层 (ATL),适用于运行 Google Play 服务的 Android 设备
- 适用于 Apple 设备的 Apple 推送通知服务 (APNs)
Web 应用的网络推送协议
用户设备上的 FCM SDK,根据应用的前台/后台状态和任何相关应用逻辑显示通知或处理消息。
生命周期流
- 注册设备以接收来自 FCM 的消息。客户端应用的实例注册以接收消息,并获取唯一标识应用实例的注册令牌。
- 发送和接收下行消息。
- 发送消息。应用服务器向客户端应用发送消息:
- 消息会在通知编辑器或受信任的环境中编写,并且消息请求会被发送到 FCM 后端。
- FCM 后端接收消息请求,生成消息 ID 和其他元数据,并将其发送到平台特定的传输层。
- 当设备在线时,系统会通过平台特定的传输层将消息发送到设备。
- 在设备上,客户端应用会接收到消息或通知。
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-12-01 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]