# @capacitor-firebase/remote-config 中文文档

规范地址：https://npmcn.com/package/%40capacitor-firebase/remote-config/

版本：8\.6\.0
npm 元数据更新时间：2026-10-31T07:03:05.247Z
中文译文更新时间：2026-11-09T03:24:50.658Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40capacitor-firebase/remote-config
原文对照：https://npmcn.com/package/%40capacitor-firebase/remote-config/?lang=original
项目主页：https://capawesome.io/
源码仓库：https://github.com/capawesome-team/capacitor-firebase

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

- 包体积（解压后）：178 kB，43 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：firebase ^12\.6\.0，@capacitor/core \>=8\.0\.0
- 首次发布：2022-11-16T21:22:28.169Z
- 最新版本发布：2026-10-31T07:03:04.898Z
- 近 30 天下载量：50691（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：39（近 12 个月 13 个）

## 中文简介

用于Android,iOS,和Web上的Firebase远程配置的电容插件.

## 安装

```sh
npm install @capacitor-firebase/remote-config
```

也可以使用：`pnpm add @capacitor-firebase/remote-config`、`yarn add @capacitor-firebase/remote-config`、`bun add @capacitor-firebase/remote-config`

## README

# Firebase 远程配置插件

非官方电容插件 [远程配置](https://firebase.google.com/docs/remote-config)\[^1\]

[![Try Capawesome Cloud free for 14 days — iOS builds without a Mac](https://capawesome.io/assets/banners/cloud-free-trial-capacitor-apps.png)](https://capawesome.io/)

## 使用大小写

Firebase远程配置插件通常用于改变您的应用程序的行为和外观,而不发布应用程序更新,例如:

-   **地物标志**:通过远程取出布尔参数,逐步推出新特性.
-   **晋升**: 远程启动销售或促销,例如通过 `is_sale` 参数.
-   **维修通知**:向用户通报即将进行的维护,而不发布新的应用版本.
-   **实时更新**: 使用配置更新收听器实时对配置变化进行响应.
-   **默认值**: 提供应用中的默认值, 这样您的应用程序在第一次获取前可以预测到行为 .

## 兼容性

| 插件版本 | 电容版本 | 状态 |
| --- | --- | --- |
| 8.x.x (英语) | \>=8.x.x | 积极支持 |
| 7.x.x (中文(简体) ) | 7.x.x (中文(简体) ) | 折旧 |
| 6.x.x (中文(简体) ) | 6.x.x (中文(简体) ) | 折旧 |
| 5.x.x (中文(简体) ) | 5.x.x (中文(简体) ) | 折旧 |

## 指南

-   [带有远程配置的 Capacitor App 中的特性旗](https://capawesome.io/blog/capacitor-firebase-remote-config-guide/): 特性旗, 已相继推出, 以及此插件的实时配置更新 .
-   [如何在电容App中使用火把](https://capawesome.io/blog/how-to-use-firebase-in-a-capacitor-app/): 如何将特征旗插入家庭的其余部分,包括他们针对的Analytics受众.

## 安装

你可以用我们的 **AI 辅助设置** 以安装插件. 添加数据 [超级技能](https://github.com/capawesome-team/skills) 至您的 AI 工具,使用以下命令:

```bash
npx skills add capawesome-team/skills --skill capacitor-plugins
```

然后使用下列提示:

```
Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capacitor-firebase/remote-config` plugin in my project.
```

如果你喜欢 **手动设置**,通过运行以下命令来安装插件,并遵循下面的平台特定指令:

```bash
npm install @capacitor-firebase/remote-config firebase
npx cap sync
```

如果您还没有将 Firebase 添加到您的项目中([机器人](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#android) 编号 : [iOS系统](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#ios) 编号 : [网页](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#web)) (中文(简体) ).

### 机器人

需要谷歌分析 [有条件选择应用实例](https://firebase.google.com/docs/remote-config/parameters#conditions_rules_and_conditional_values) 用于用户属性和受众。 确定您安装 [电容火碱分析](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/analytics) 工程中的插件 .

#### 变量

如果需要, 您可以在您的应用程序中定义以下工程变量 `variables.gradle` 要更改依赖的默认版本的文件 :

-   `$firebaseConfigVersion` 版本 `com.google.firebase:firebase-config` (默认 : `23.0.1`(中文(简体) )

如果您在工程中遇到其它插件的依赖性冲突, 这会有所帮助 .

### iOS系统

#### Swift 软件包管理器

在您的 `capacitor.config.json` (或 `capacitor.config.ts`) 避免 [SwiftPM 软件包识别相撞](https://github.com/capawesome-team/capacitor-firebase/issues/959)数字 :

```json
{
  "experimental": {
    "ios": {
      "spm": {
        "packageOptions": {
          "@capacitor-firebase/remote-config": {
            "symlink": true
          }
        }
      }
    }
  }
}
```

**请注意**目标 `packageOptions` 支持需要控制器 CLI **8.4.0+ (中文(简体) )**。 。 。 .

## 配置

此插件不需要配置 .

## 演示

这里有一个实例: [robingenz/电容器-火力基地-插座-demo](https://github.com/robingenz/capacitor-firebase-plugin-demo)

## 启动模板

以下启动模板可供使用:

-   [角起火点](https://ionstarter.dev/)

## 使用量

以下示例显示如何获取并激活配置,读取配置值,配置获取行为,设置自定义信号,并实时收听配置更新.

### 获取并激活配置

从远程配置服务中获取最新配置并激活,使其提供给获取者. 使用 `fetchAndActivate()` 立即执行两项行动。 在Android和iOS上,您可以通过最小的获取间隔到 `fetchConfig(...)`数字 :

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const fetchConfig = async () => {
  await FirebaseRemoteConfig.fetchConfig({
    minimumFetchIntervalInSeconds: 1200,
  });
};

const activate = async () => {
  await FirebaseRemoteConfig.activate();
};

const fetchAndActivate = async () => {
  await FirebaseRemoteConfig.fetchAndActivate();
};
```

### 读取配置值

将给定键的值读取为布尔、数字或字符串 :

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const getBoolean = async () => {
  const { value } = await FirebaseRemoteConfig.getBoolean({
    key: 'is_sale',
  });
  return value;
};

const getNumber = async () => {
  const { value } = await FirebaseRemoteConfig.getNumber({
    key: 'upcoming_maintenance',
  });
  return value;
};

const getString = async () => {
  const { value } = await FirebaseRemoteConfig.getString({
    key: 'license_key',
  });
  return value;
};
```

### 配置获取行为

设定获取超时和最小获取间隔 。 在开发过程中,建议设定相对较低的最小取取间隔:

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const setSettings = async () => {
  await FirebaseRemoteConfig.setSettings({
    fetchTimeoutInSeconds: 10,
    minimumFetchIntervalInSeconds: 0,
  });
};
```

### 设置自定义信号

设置应用程序实例的自定义信号, 用于远程配置条件下的目标设定 。 带有信号的信号 `null` 将删除值 :

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const setCustomSignals = async () => {
  await FirebaseRemoteConfig.setCustomSignals({
    customSignals: {
      city: 'Berlin',
      preferred_event_category: 'concerts',
    },
  });
};
```

### 实时监听配置更新

为配置更新事件添加一个监听器,一旦参数值发生变化,将立即通知。 仅在Android和iOS上提供:

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const addConfigUpdateListener = async () => {
  const callbackId = await FirebaseRemoteConfig.addConfigUpdateListener(
    (event, error) => {
      if (error) {
        console.error(error);
      } else {
        console.log(event);
      }
    }
  );
  return callbackId;
};

const removeConfigUpdateListener = async (callbackId: string) => {
  await FirebaseRemoteConfig.removeConfigUpdateListener({
    callbackId,
  });
};
```

### 删除所有听众

删除所有为此插件添加的听众 :

```typescript
import { FirebaseRemoteConfig } from '@capacitor-firebase/remote-config';

const removeAllListeners = async () => {
  await FirebaseRemoteConfig.removeAllListeners();
};
```

## API 密码

-   [`activate()`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-activate)
-   [`fetchAndActivate()`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-fetchandactivate)
-   [`fetchConfig(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-fetchconfig)
-   [`getBoolean(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getboolean)
-   [`getNumber(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getnumber)
-   [`getString(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getstring)
-   [`getAll()`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getall)
-   [`getInfo()`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getinfo)
-   [`setMinimumFetchInterval(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setminimumfetchinterval)
-   [`setCustomSignals(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setcustomsignals)
-   [`setDefaults(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setdefaults)
-   [`setSettings(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setsettings)
-   [`addConfigUpdateListener(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-addconfigupdatelistener)
-   [`removeConfigUpdateListener(...)`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-removeconfigupdatelistener)
-   [`removeAllListeners()`](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-removealllisteners)
-   [接口](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-interfaces)
-   [类型异名](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-type-aliases)
-   [数字](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-enums)

### 激活( c)

```typescript
activate() => Promise<void>
```

向获取者提供上次获取的配置 .

**自:** 1.3.0 (单位:千美元)

* * *

### 获取And Activate ()

```typescript
fetchAndActivate() => Promise<void>
```

执行获取并激活操作 .

**自:** 1.3.0 (单位:千美元)

* * *

### 获取 Config (...)

```typescript
fetchConfig(options?: FetchConfigOptions | undefined) => Promise<void>
```

从远程配置服务获取并缓存配置 .

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[FetchConfigOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-fetchconfigoptions)` |

**自:** 1.3.0 (单位:千美元)

* * *

### 获取 Boolean (...)

```typescript
getBoolean(options: GetBooleanOptions) => Promise<GetBooleanResult>
```

获取给定的密钥作为布尔值 .

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)` |

**回返情况:** `Promise<[GetBooleanResult](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getbooleanresult)>`

**自:** 1.3.0 (单位:千美元)

* * *

### 获取数字(...)

```typescript
getNumber(options: GetNumberOptions) => Promise<GetNumberResult>
```

获取给定密钥作为数字的值 .

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)` |

**回返情况:** `Promise<[GetNumberResult](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getnumberresult)>`

**自:** 1.3.0 (单位:千美元)

* * *

### 获取 String (...)

```typescript
getString(options: GetStringOptions) => Promise<GetStringResult>
```

获取给定键作为字符串的值 .

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)` |

**回返情况:** `Promise<[GetStringResult](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getstringresult)>`

**自:** 1.3.0 (单位:千美元)

* * *

### 获取全部( E)

```typescript
getAll() => Promise<GetAllResult>
```

从远程配置服务中获取所有值 .

**回返情况:** `Promise<[GetAllResult](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getallresult)>`

**自:** 8.3.0 (单位:千美元)

* * *

### 获取信息 ()

```typescript
getInfo() => Promise<GetInfoResult>
```

获取上次获取操作的信息 .

**回返情况:** `Promise<[GetInfoResult](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getinforesult)>`

**自:** 7.5.0 (中文(简体) )

* * *

### 设置最小切入(...)

```typescript
setMinimumFetchInterval(options: SetMinimumFetchIntervalOptions) => Promise<void>
```

设定最小获取间隔 .

仅供Web使用.

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[SetMinimumFetchIntervalOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setminimumfetchintervaloptions)` |

**自:** 1.3.0 (单位:千美元)

* * *

### 设置自定义符号(...)

```typescript
setCustomSignals(options: SetCustomSignalsOptions) => Promise<void>
```

设置应用程序实例的自定义信号, 用于远程配置条件下的目标设定 .

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[SetCustomSignalsOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setcustomsignalsoptions)` |

**自:** 8.4.0 (单位:百万美元)

* * *

### 默认值(...)

```typescript
setDefaults(options: SetDefaultsOptions) => Promise<void>
```

在默认的名称空间配置中设置参数密钥和值的配置默认值.

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[SetDefaultsOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setdefaultsoptions)` |

**自:** 8.3.0 (单位:千美元)

* * *

### 设置设置(...)

```typescript
setSettings(options: SetSettingsOptions) => Promise<void>
```

设置远程配置设置 .

在Android上,设置值在"共享优先"中被坚持.

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[SetSettingsOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-setsettingsoptions)` |

**自:** 6.2.0 (单位:千美元)

* * *

### 添加 Config Update 倾听器(...)

```typescript
addConfigUpdateListener(callback: AddConfigUpdateListenerOptionsCallback) => Promise<CallbackId>
```

为配置更新事件添加一个收听器 .

仅供Android和iOS使用.

| 参数 | 类型 |
| --- | --- |
| **`callback`** | `[AddConfigUpdateListenerOptionsCallback](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-addconfigupdatelisteneroptionscallback)` |

**回返情况:** `Promise<string>`

**自:** 5.4.0 (单位:千美元)

* * *

### 删除 Config Update 倾听器(...)

```typescript
removeConfigUpdateListener(options: RemoveConfigUpdateListenerOptions) => Promise<void>
```

删除配置更新事件的听众 .

仅供Android和iOS使用.

| 参数 | 类型 |
| --- | --- |
| **`options`** | `[RemoveConfigUpdateListenerOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-removeconfigupdatelisteneroptions)` |

**自:** 5.4.0 (单位:千美元)

* * *

### 删除所有收听器( )

```typescript
removeAllListeners() => Promise<void>
```

删除此插件的所有听众 .

**自:** 5.4.0 (单位:千美元)

* * *

### 接口

#### 获取配置选项

| Prop | 类型 | 说明 | 默认 | 自兹 |
| --- | --- | --- | --- | --- |
| **`minimumFetchIntervalInSeconds`** | `number` | 定义配置缓存中一个条目的最大年龄( 秒) 。 在开发期间,建议设定相对较低的最低取取间隔. 仅供Android和iOS使用. | `43200` | 1.3.0 (单位:千美元) |

#### 获取 Boolean 遗书

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`value`** | `boolean` | 给定键作为布尔值的值 . | 1.3.0 (单位:千美元) |
| **`source`** | `[GetValueSource](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getvaluesource)` | 说明这一值的来源. | 1.3.0 (单位:千美元) |

#### 获取选项

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`key`** | `string` | 值取之关键. | 1.3.0 (单位:千美元) |

#### 获取数字结果

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`value`** | `number` | 给定密钥作为数字的值 . | 1.3.0 (单位:千美元) |
| **`source`** | `[GetValueSource](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getvaluesource)` | 说明这一值的来源. | 1.3.0 (单位:千美元) |

#### 获取斯特林结果

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`value`** | `string` | 作为字符串的给定密钥值 . | 1.3.0 (单位:千美元) |
| **`source`** | `[GetValueSource](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getvaluesource)` | 说明这一值的来源. | 1.3.0 (单位:千美元) |

#### 获取全部结果

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`values`** | `Record<string, [GetAllResultValue](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getallresultvalue)>` | 所有密钥的值 . | 8.3.0 (单位:千美元) |

#### 获取全部结果值

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`value`** | `string` | 作为字符串的值 . | 8.3.0 (单位:千美元) |
| **`source`** | `[GetValueSource](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getvaluesource)` | 说明这一值的来源. | 8.3.0 (单位:千美元) |

#### 获取信息结果

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`lastFetchTime`** | `number` | 以上次成功获取的毫秒为单位的 Unix 时间戳, 或 - 1 如果没有获取或初始化, 则不完整 . | 7.5.0 (中文(简体) ) |
| **`lastFetchStatus`** | `[LastFetchStatus](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-lastfetchstatus)` | 上次获取尝试的状态 . | 7.5.0 (中文(简体) ) |

#### 设置最小切换间隔选项

| Prop | 类型 | 说明 | 默认 | 自兹 |
| --- | --- | --- | --- | --- |
| **`minimumFetchIntervalInSeconds`** | `number` | 定义配置缓存中一个条目的最大年龄( 秒) 。 在开发期间,建议设定相对较低的最低取取间隔. | `43200` | 1.3.0 (单位:千美元) |

#### 设置自定义符号选项

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`customSignals`** | `Record<string, string | number | null>` | 要设置应用实例的自定义信号 。 带有信号的信号 `null` 值将被删除. | 8.4.0 (单位:百万美元) |

#### 设置默认选项

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`defaults`** | `Record<string, string | number | boolean>` | 定义要设置为默认值的字典. | 8.3.0 (单位:千美元) |

#### 设置选项

| Prop | 类型 | 说明 | 默认 | 自兹 |
| --- | --- | --- | --- | --- |
| **`fetchTimeoutInSeconds`** | `number` | 定义从远程配置服务器获取配置时等待响应的最大毫秒数. | `60` | 6.2.0 (单位:千美元) |
| **`minimumFetchIntervalInSeconds`** | `number` | 定义配置缓存中一个条目的最大年龄( 秒) 。 在开发期间,建议设定相对较低的最低取取间隔. | `43200` | 6.2.0 (单位:千美元) |

#### 添加Config Update 收听器可选回调程序

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`updatedKeys`** | `string[]` | 参数键,其值已从当前激活的值中更新. | 5.4.0 (单位:千美元) |

#### 删除配置更新收听器选项

| Prop | 类型 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`id`** | `[CallbackId](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-callbackid)` | 听者所取之所证. | 5.4.0 (单位:千美元) |

### 类型异名

#### 获取 Boolean 选项

`[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)`

#### 获取数字选项

`[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)`

#### 获取 String 选项

`[GetOptions](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-getoptions)`

#### 添加Config Update 收听器可选调用

`(event: [AddConfigUpdateListenerOptionsCallbackEvent](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-addconfigupdatelisteneroptionscallbackevent) | null, error: any): void`

#### 调用文件夹

`string`

### 数字

#### 获取值源

| 成员 | 数值 | 说明 | 自兹 |
| --- | --- | --- | --- |
| **`Static`** | `0` | 表示返回的值是静态默认值. | 1.3.0 (单位:千美元) |
| **`Default`** | `1` | 表示返回的值是从客户端设定的默认值中取出 . | 1.3.0 (单位:千美元) |
| **`Remote`** | `2` | 表示返回的值是从 Firebase 远程配置服务器取出 . | 1.3.0 (单位:千美元) |

#### 最后一个图像状态

| 成员 | 数值 |
| --- | --- |
| **`NoFetchYet`** | `0` |
| **`Success`** | `1` |
| **`Failure`** | `2` |
| **`Throttled`** | `3` |

## 财务问题

### 为什么获得者返回默认值而不是远程值?

获取的配置值必须在获取器可用之前激活 。 打电话 `fetchConfig(...)` 接下来是 `activate()`,或使用 `fetchAndActivate()` 如本报告所示,将同时开展这两项行动 [使用示例](https://npmcn.com/package/%40capacitor-firebase/remote-config/#readme-fetch-and-activate-the-configuration) 见上文.

### 插件多久获取新配置值 ?

获取的配置值被缓存 。 最小取取间隔定义了在被视作 stale 之前在配置缓存中一个条目的最大年龄以秒为单位,默认为43200秒(12小时). 在开发期间,建议使用 `setSettings(...)` 安卓与iOS或 `setMinimumFetchInterval(...)` 在网络上.

### 我对实时的配置变化有什么反应?

使用 `addConfigUpdateListener(...)` 当参数值发生变化时立即通知,包括更新了数值的密钥。 这种方法仅在Android和iOS上可用. 你可以再次删除听众 `removeConfigUpdateListener(...)` 或者说 `removeAllListeners()`。 。 。 .

### 我需要Firebase分析插件来使用远程配置吗?

Google Analytics只用于有条件地将应用实例瞄准用户属性和受众. 如果想要使用条件,请确保同时安装 [电容火碱分析](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/analytics) 工程中的插件 .

### 我怎么知道一个配置值是从哪里来的?

获取者返回a `source` 属性外加值。 它表示该值是否是静态默认值,是从客户端设定的默认取出,还是从Firebase远程配置服务器取出.

## 相关插件

-   [火场分析](https://capawesome.io/docs/sdks/capacitor/firebase/analytics/): 记录带有Firebase分析器的事件和用户属性.
-   [实时更新](https://capawesome.io/docs/sdks/capacitor/live-update/): 实时更新你的应用程序,而不要求用户从应用程序商店下载新版本.

## 通讯

随时更新有关卡帕韦索姆、Capacitor和Ionic生态系统的最新消息和最新消息,因为我们 [《卡帕索克通讯》](https://cloud.capawesome.io/newsletter/)。 。 。 .

## 更改日志

见 [变动情况](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/remote-config/CHANGELOG.md)。 。 。 .

## 许可证

见 [自由主义](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/remote-config/LICENSE)。 。 。 .

\[^1\]: 这个项目不附属于Google LLC或其任何子公司或子公司,也不获得其认可、支持、赞助或批准.

## 常见问题

### @capacitor-firebase/remote-config 是什么？

用于Android,iOS,和Web上的Firebase远程配置的电容插件\.

### 如何安装 @capacitor-firebase/remote-config？

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

### @capacitor-firebase/remote-config 支持 TypeScript 吗？

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

### @capacitor-firebase/remote-config 支持 ESM 还是 CommonJS？

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

### @capacitor-firebase/remote-config 可以商用吗？

@capacitor-firebase/remote-config 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @capacitor-firebase/remote-config 的下载量有多少？

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

### @capacitor-firebase/remote-config 还在维护吗？

最新版本 8\.6\.0 发布于 2026/10/31（9 天前）；至今共发布 39 个版本，其中过去 12 个月发布了 13 个；首次发布于 2022/11/17。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

