# @capacitor-community/fcm 中文文档

规范地址：https://npmcn.com/package/%40capacitor-community/fcm/

版本：8\.2\.2
npm 元数据更新时间：2026-10-23T21:47:52.251Z
中文译文更新时间：2026-11-09T02:21:30.532Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40capacitor-community/fcm
原文对照：https://npmcn.com/package/%40capacitor-community/fcm/?lang=original
项目主页：https://github.com/capacitor-community/fcm#readme
源码仓库：https://github.com/capacitor-community/fcm

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：59.9 kB，25 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：@capacitor/core \>=8\.0\.0
- 首次发布：2020-06-27T19:48:15.717Z
- 最新版本发布：2026-09-29T14:19:38.486Z
- 近 30 天下载量：134863（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：37（近 12 个月 8 个）

## 中文简介

启用 Capacitor app 的 Firebase 云消息功能

## 安装

```sh
npm install @capacitor-community/fcm
```

也可以使用：`pnpm add @capacitor-community/fcm`、`yarn add @capacitor-community/fcm`、`bun add @capacitor-community/fcm`

## README

  
![](https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png)

### FCM 控制器

**`@capacitor-community/fcm`**

启用 FCM 能力的电容社区插件

![](https://img.shields.io/maintenance/yes/2026?style=flat-square) [![](https://img.shields.io/npm/l/@capacitor-community/fcm?style=flat-square)](https://www.npmjs.com/package/@capacitor-community/fcm)  
[![](https://img.shields.io/npm/dw/@capacitor-community/fcm?style=flat-square)](https://www.npmjs.com/package/@capacitor-community/fcm) [![](https://img.shields.io/npm/v/@capacitor-community/fcm?style=flat-square)](https://www.npmjs.com/package/@capacitor-community/fcm) [![](https://img.shields.io/badge/all%20contributors-31-orange?style=flat-square)](https://npmcn.com/package/%40capacitor-community/fcm/#readme-contributors)

## 维护者

| 维护者 | GitHub 图像 | 社会 |
| --- | --- | --- |
| 斯特万·席尔瓦 | [炖鱼](https://github.com/stewones) | [@stewones (英语)](https://x.com/stewones) |

## 通知

我们从一个正式的Ong开始 如果您使用上一个 npm 软件包 `capacitor-fcm`请更新您的软件包 `@capacitor-community/fcm`检查 [更改日志](https://npmcn.com/CHANGELOG.md) 需要更多信息.

## 安装

使用 npm :

```bash
npm install @capacitor-community/fcm
```

使用线条 :

```bash
yarn add @capacitor-community/fcm
```

同步本地文件 :

```bash
npx cap sync
```

### 兼容性

| 插件 | 电容 | iOS 部署目标 | 机器人 `minSdkVersion` |
| --- | --- | --- | --- |
| 8.1.0+ (单位:千美元) | 第8条 | 15.0 (韩语) | 24个 |
| 7.x - 8.0.x (中文(简体) ) | 第7条 | 14.0 (韩语) | 第23条 |
| 6.x (单位:千美元) | 6个 | 13.0 (韩语) | 22个 |
| 4.x - 5.x (英语) | 页:1 | 13.0 (韩语) | 22个 |
| 3.x 运算 | 页:1 | 13.0 (韩语) | 22个 |

> ### 通知
> 
> 此插件旨在与 Capacitor API 结合使用 [推动通知](https://capacitor.ionicframework.com/docs/apis/push-notifications)。 Capacitor 仅提供 APN 令牌,而这个插件提供了与 FCM 令牌和更多符号合作的可能性.

## API 密码

| 方法 | 资讯 | 平台 |
| --- | --- | --- |
| `subscribeTo` | 订阅 fcm 话题 | ios/类固醇 |
| `unsubscribeFrom` | 从 fcm 话题取消订阅 | ios/类固醇 |
| `getToken` | 从服务器获取 fcm 令牌最终使用 | ios/类固醇 |
| `refreshToken` | 刷新 fcm 令牌以获得新的 | ios/类固醇 |
| `deleteInstance` | 完全删除本地 fcm 实例 | ios/类固醇 |
| `setAutoInit` | 启用库的自动初始化 | ios/类固醇 |
| `isAutoInitEnabled` | 检查是否启用了自动初始化 | ios/类固醇 |

| 事件 | 资讯 | 平台 |
| --- | --- | --- |
| `tokenReceived` | 随火而起 `{ token }` 当 FCM 发行或旋转符号时。 在Android上,听Push Notifics的 `registration` 事件; 其值为 FCM 符号 | 欧斯 |

## 使用量

```ts
import { FCM } from '@capacitor-community/fcm';
import { PushNotifications } from '@capacitor/push-notifications';

// external required step
// register for push
await PushNotifications.requestPermissions();
await PushNotifications.register();

// now you can subscribe to a specific topic
FCM.subscribeTo({ topic: 'test' })
  .then(r => alert(`subscribed to topic`))
  .catch(err => console.log(err));

// Unsubscribe from a specific topic
FCM.unsubscribeFrom({ topic: 'test' })
  .then(() => alert(`unsubscribed from topic`))
  .catch(err => console.log(err));

// Get FCM token instead of the APN one returned by Capacitor
FCM.getToken()
  .then(r => alert(`Token ${r.token}`))
  .catch(err => console.log(err));

// Delete the old FCM token and get a new one
FCM.refreshToken()
  .then(r => alert(`Token ${r.token}`))
  .catch(err => console.log(err));

// Remove FCM instance
FCM.deleteInstance()
  .then(() => alert(`Token deleted`))
  .catch(err => console.log(err));

// Enable the auto initialization of the library
FCM.setAutoInit({ enabled: true }).then(() => alert(`Auto init enabled`));

// Check the auto initialization status
FCM.isAutoInitEnabled().then(r => {
  console.log('Auto init is ' + (r.enabled ? 'enabled' : 'disabled'));
});
```

## 添加 Google 配置文件

导航您在 Firebase 上的应用程序的工程设置页面 .

### iOS系统

下载 `GoogleService-Info.plist` 文档。 在 Xcode 中右键单击名为“ App” 的黄色文件夹,并选择 `Add files to "App"`。 。 。 .

> 提示:如果拖放文件到此位置, Xcode 可能找不到它 .

### 机器人

下载 `google-services.json` 存档并复制到 `android/app/` 您的电容器项目目录 .

### 证书

-   苹果
    -   创建应用程序标识符( apple site)
        -   添加按键通知
        -   添加签名请求( e)[https://developer.apple.com/help/count/certificates/create-a-certificate-signing-request 页面存档备份,存于互联网档案馆 (简体中文)](https://developer.apple.com/help/account/certificates/create-a-certificate-signing-request)(中文(简体) )
        -   生成 APN 密钥,然后在显示的ID下注出。 也下载 p8 文件 ([https://fluffy.es/p8-push- notification/ (中文(简体) )](https://fluffy.es/p8-push-notification/)(中文(简体) )
-   火场
    -   将已下载的 p8 文件添加到 Firebase 设置中, 并带有已注解的密钥 ID 和账户团队 ID

## iOS 设置

-   [安装本地人](https://capacitorjs.com/docs/getting-started/environment-setup#homebrew) _(一次)_
-   `brew install cocoapods` _(一次性)_
-   `ionic start my-cap-app --capacitor`
-   `cd my-cap-app`
-   `mkdir www && touch www/index.html`
-   `npx cap add ios`
-   `npm install --save @capacitor-community/fcm`
-   `npx cap sync ios` _(插件安装后总是同步)_
-   `npx cap open ios`

-   在 xcode( 一般标签) 签名您的应用程序
-   启用远程通知能力
-   添加 `GoogleService-Info.plist` 到 xcode 中的应用程序文件夹

```
// (optional) turn off `swizzling` in the `info.plist`
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
```

> 提示:每次您更改本地代码时, 您可能需要清理缓存( Product > Clean building文件夹) , 然后再次运行应用程序 .

### 防止自动初始化

如果您需要执行 option- in 行为, 您可以通过遵循 [火场文件](https://firebase.google.com/docs/cloud-messaging/ios/client#prevent_auto_initialization)。 。 。 .

### SPM设置(iOS 15.0+)

**首先确保您的所有依赖关系与 SPM 兼容 。 否则,坚持Cocoapods安装步骤.**

您也可以使用 Swift 包管理器( SPM) 而不是 CocoaPods 安装插件 . 要做到这一点,你不需要安装CocoaPods(步骤1和2),但需要配置电容器来使用SPM:

-   添加 iOS 目标 : `npx cap add ios --packagemanager SPM`
-   迁移现有目标: `npx cap spm-migration-assistant` (用电容器 7.4.0+).

你可以在官网上找到更多的信息 [电容器文件](https://capacitorjs.com/docs/ios/spm)。 。 。 .

## 机器人设置

-   `ionic start my-cap-app --capacitor`
-   `cd my-cap-app`
-   `mkdir www && touch www/index.html`
-   `npx cap add android`
-   `npm install --save @capacitor-community/fcm`
-   `npx cap sync android` _(插件安装后总是同步)_
-   `npx cap open android`
-   添加 `google-services.json` 给您的 `android/app` 文件夹

现在你该走了 尝试使用 `ionic cap run android --livereload`。 。 。 .

> 提示:每次您更改本地代码, 您可能需要清理缓存( Build > Clean Project QQ Build > Rebuilt Project) , 然后再次运行应用程序 .

### 变量

此插件将使用以下工程变量( 在您的应用程序中定义) `variables.gradle` 文件名 :

-   `$firebaseMessagingVersion` 版本 `com.google.firebase:firebase-messaging` (默认 : `25.0.1`(中文(简体) )

### 防止自动初始化

如果您需要执行 option- in 行为, 您可以通过遵循 [火场文件](https://firebase.google.com/docs/cloud-messaging/android/client#prevent-auto-init)。 。 。 .

## 示例

-   [https://github.com/concessor-community/fcm/tree/master/example 互联网档案馆的存檔,存档日期2014-12-22](https://github.com/capacitor-community/fcm/tree/master/example)

## 许可证

麻省理工学院

## 贡献者

感谢这些伟大的人[emoji 密钥](https://allcontributors.org/docs/en/emoji-key):

<table><tbody><tr><td align="center"><a href="https://twitter.com/stewones" rel="nofollow noopener noreferrer"><img alt="stewones" src="https://avatars1.githubusercontent.com/u/719763?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>炖鱼</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=stewones" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://github.com/danielprrazevedo" rel="nofollow noopener noreferrer"><img alt="Daniel Pereira" src="https://avatars2.githubusercontent.com/u/20153661?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>丹尼尔·佩雷拉</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=danielprrazevedo" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="http://priyankpatel.io/" rel="nofollow noopener noreferrer"><img alt="Priyank Patel" src="https://avatars3.githubusercontent.com/u/5585797?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>普里扬克帕特尔</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=priyankpat" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="http://fuubar.wordpress.com/" rel="nofollow noopener noreferrer"><img alt="Nikolas" src="https://avatars1.githubusercontent.com/u/1230033?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>尼古拉斯</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-nikoskip" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://lights0123.com/" rel="nofollow noopener noreferrer"><img alt="Ben Schattinger" src="https://avatars3.githubusercontent.com/u/3756309?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>本·沙廷格</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=lights0123" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr><tr><td align="center"><a href="https://binary.com.au/" rel="nofollow noopener noreferrer"><img alt="James Manners" src="https://avatars2.githubusercontent.com/u/175909?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>詹姆斯·曼纳斯</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=jmannau" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/borodiliz" rel="nofollow noopener noreferrer"><img alt="Borja Rodríguez" src="https://avatars3.githubusercontent.com/u/2467193?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>博尔贾·罗德里格斯</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-borodiliz" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/Karrlllis" rel="nofollow noopener noreferrer"><img alt="Karrlllis" src="https://avatars1.githubusercontent.com/u/37330643?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>卡丽丝</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=Karrlllis" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://github.com/jamesmah" rel="nofollow noopener noreferrer"><img alt="jamesmah" src="https://avatars0.githubusercontent.com/u/21981049?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>贾梅斯玛</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=jamesmah" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/josh-m-sharpe" rel="nofollow noopener noreferrer"><img alt="Josh Sharpe" src="https://avatars3.githubusercontent.com/u/39473?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>乔什·夏普</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-josh-m-sharpe" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td></tr><tr><td align="center"><a href="https://github.com/msimkunas" rel="nofollow noopener noreferrer"><img alt="Mantas Šimkūnas" src="https://avatars.githubusercontent.com/u/9675250?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>曼塔斯·辛克纳斯</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/capacitor-community/fcm/commits?author=msimkunas" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://github.com/iOlivier" rel="nofollow noopener noreferrer"><img alt="Olivier Overstraete" src="https://avatars.githubusercontent.com/u/12254953?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>奥利维耶</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-iOlivier" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://hemang.dev/" rel="nofollow noopener noreferrer"><img alt="Hemang Kumar" src="https://avatars.githubusercontent.com/u/13018570?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>赫芒·库马尔</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=hemangsk" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-hemangsk" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/mesqueeb" rel="nofollow noopener noreferrer"><img alt="Luca Ban" src="https://avatars.githubusercontent.com/u/3253920?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>卢卡·班</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=mesqueeb" title="Documentation" rel="nofollow noopener noreferrer">📖</a></td><td align="center"><a href="https://www.alexgriffith.me/" rel="nofollow noopener noreferrer"><img alt="Alex Griffith" src="https://avatars.githubusercontent.com/u/5904472?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚历克斯·格里菲斯</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=halomademeapc" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-halomademeapc" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td></tr><tr><td align="center"><a href="https://github.com/bdirito" rel="nofollow noopener noreferrer"><img alt="bdirito" src="https://avatars.githubusercontent.com/u/8117238?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>语气</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-bdirito" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/mineminemine" rel="nofollow noopener noreferrer"><img alt="Ryan" src="https://avatars.githubusercontent.com/u/17585549?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>莱恩</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-mineminemine" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/josuelmm" rel="nofollow noopener noreferrer"><img alt="Josué Moreno" src="https://avatars.githubusercontent.com/u/12968781?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>何塞·莫雷诺</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=josuelmm" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://marcjulian.de/?ref=github" rel="nofollow noopener noreferrer"><img alt="Marc" src="https://avatars.githubusercontent.com/u/8985933?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>马克</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-marcjulian" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://floriangyger.ch/" rel="nofollow noopener noreferrer"><img alt="Florian Gyger" src="https://avatars.githubusercontent.com/u/1215256?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>弗洛里安·盖格</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=flogy" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr><tr><td align="center"><a href="http://www.jcesarmobile.com/" rel="nofollow noopener noreferrer"><img alt="jcesarmobile" src="https://avatars.githubusercontent.com/u/1637892?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>jcesarmobile 移动</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-question-jcesarmobile" title="Answering Questions" rel="nofollow noopener noreferrer">💬</a> <a href="https://github.com/capacitor-community/fcm/commits?author=jcesarmobile" title="Documentation" rel="nofollow noopener noreferrer">📖</a> <a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-jcesarmobile" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/ramikhafagi96" rel="nofollow noopener noreferrer"><img alt="Rami Khafagi" src="https://avatars.githubusercontent.com/u/38646828?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>拉米・哈法吉</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=ramikhafagi96" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/bipoza" rel="nofollow noopener noreferrer"><img alt="Bittor Poza" src="https://avatars.githubusercontent.com/u/26112509?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>比特尔·波扎</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=bipoza" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/Vishal-Isharani" rel="nofollow noopener noreferrer"><img alt="Vishal Isharani" src="https://avatars.githubusercontent.com/u/10386581?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>维沙尔·伊斯哈拉尼</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-Vishal-Isharani" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a> <a href="https://github.com/capacitor-community/fcm/commits?author=Vishal-Isharani" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/kashz" rel="nofollow noopener noreferrer"><img alt="Shunta KARASAWA" src="https://avatars.githubusercontent.com/u/12661101?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>赞比亚</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-kashz" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td></tr><tr><td align="center"><a href="http://www.chrisweight.com/" rel="nofollow noopener noreferrer"><img alt="Chris Weight" src="https://avatars.githubusercontent.com/u/468638?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>克里斯体重</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-chrisweight" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://by.vincent.mahn.ke/" rel="nofollow noopener noreferrer"><img alt="Vincent Mahnke" src="https://avatars.githubusercontent.com/u/1689033?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>文森特·马恩克</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-maintenance-ViMaSter" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a></td><td align="center"><a href="https://github.com/tompidom" rel="nofollow noopener noreferrer"><img alt="tompidom" src="https://avatars.githubusercontent.com/u/47992794?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>自杀</b></sub></a><br><a href="https://npmcn.com/package/%40capacitor-community/fcm/#readme-infra-tompidom" title="Infrastructure (Hosting, Build-Tools, etc)" rel="nofollow noopener noreferrer">🚇</a></td><td align="center"><a href="https://github.com/DavidBowdoin" rel="nofollow noopener noreferrer"><img alt="David Bowdoin" src="https://avatars.githubusercontent.com/u/3190879?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>戴维·鲍多因</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=DavidBowdoin" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/tiennp-dev" rel="nofollow noopener noreferrer"><img alt="tiennp-dev" src="https://avatars.githubusercontent.com/u/74178245?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>龙卷风</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=tiennp-dev" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr><tr><td align="center"><a href="https://github.com/eljass" rel="nofollow noopener noreferrer"><img alt="Eljas" src="https://avatars.githubusercontent.com/u/7661970?v=4?s=75" width="75px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>埃尔哈斯</b></sub></a><br><a href="https://github.com/capacitor-community/fcm/commits?author=eljass" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr></tbody></table>

本项目遵循 [全部贡献者](https://github.com/all-contributors/all-contributors) 规格。 任何捐款都欢迎!

## 常见问题

### @capacitor-community/fcm 是什么？

启用 Capacitor app 的 Firebase 云消息功能

### 如何安装 @capacitor-community/fcm？

在项目目录运行 npm install @capacitor-community/fcm，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@capacitor/core（\>=8\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @capacitor-community/fcm 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @capacitor-community/fcm 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @capacitor-community/fcm 可以商用吗？

@capacitor-community/fcm 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @capacitor-community/fcm 的下载量有多少？

根据 npm 官方下载统计，@capacitor-community/fcm 在 2026/10/09 – 2026/11/07 这 30 天内被下载 134,863 次，日均约 4,495 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @capacitor-community/fcm 还在维护吗？

最新版本 8\.2\.2 发布于 2026/09/29（1 个月前）；至今共发布 37 个版本，其中过去 12 个月发布了 8 个；首次发布于 2020/06/28。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

