开始
复制一个带有安装步骤和完整 Markdown 指南的设置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-remote-config`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-remote-config/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
您可以使用我们的 AI 助手设置来安装插件。使用以下命令将 Capgo 技能添加到您的 AI 工具中:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-remote-config` plugin in my project.如果您更喜欢手动设置,请通过运行以下命令安装插件并按照以下平台特定的说明进行操作:
bun add @capgo/capacitor-firebase-remote-configbunx cap syncimport { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';API概述
标题为“API概述”的部分activate
标题为“激活”的部分让最后一次获取的配置可供获取器使用。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();fetchAndActivate
标题:fetchAndActivate执行 fetch 和 activate 操作。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();fetchConfig
标题:fetchConfig从 Remote Config 服务获取和缓存配置。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();getBoolean
标题:getBoolean以布尔值获取给定键的值。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getBoolean({} as GetBooleanOptions);getNumber
标题:getNumber获取给定键的值作为数字。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getNumber({} as GetNumberOptions);getString
名为“getString”的部分获取给定键的值作为字符串。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getString({} as GetStringOptions);getInfo
名为“getInfo”的部分获取有关最后一次 fetch 操作的信息。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getInfo();setMinimumFetchInterval
名为“setMinimumFetchInterval”的部分设置最小 fetch interval。
仅适用于 Web。
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({} as SetMinimumFetchIntervalOptions);setSettings
Section titled “setSettings”设置远程配置项
在 Android 上,设置值会被保存在 SharedPreferences 中
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setSettings({} as SetSettingsOptions);addConfigUpdateListener
Section titled “addConfigUpdateListener”添加配置更新事件监听器
仅适用于 Android 和 iOS
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.addConfigUpdateListener({} as AddConfigUpdateListenerOptionsCallback);removeConfigUpdateListener
Section titled “removeConfigUpdateListener”移除配置更新事件监听器
仅适用于 Android 和 iOS
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.removeConfigUpdateListener({} as RemoveConfigUpdateListenerOptions);类型参考
类型参考FetchConfigOptions
类型参考:FetchConfigOptionsexport interface FetchConfigOptions { /** * Define the maximum age in seconds of an entry in the config cache before it is considered stale. * During development, it's recommended to set a relatively low minimum fetch interval. * * Only available for Android and iOS. * * @since 1.3.0 * @default 43200 * @see https://firebase.google.com/docs/reference/js/firebase.remoteconfig.RemoteConfigSettings#minimumfetchintervalmillis */ minimumFetchIntervalInSeconds?: number;}GetBooleanOptions
类型参考:GetBooleanOptionsexport type GetBooleanOptions = GetOptions;GetBooleanResult
类型参考:GetBooleanResultexport interface GetBooleanResult { /** * The value for the given key as a boolean. * * @since 1.3.0 */ value: boolean; /** * Indicates at which source this value came from. * * Only available for Android and iOS. * * @since 1.3.0 */ source?: GetValueSource;}GetNumberOptions
类型参考:GetNumberOptionsexport type GetNumberOptions = GetOptions;GetNumberResult
类型参考:GetNumberResultexport interface GetNumberResult { /** * The value for the given key as a number. * * @since 1.3.0 */ value: number; /** * Indicates at which source this value came from. * * Only available for Android and iOS. * * @since 1.3.0 */ source?: GetValueSource;}GetStringOptions
GetStringOptionsexport type GetStringOptions = GetOptions;GetStringResult
GetStringResultexport interface GetStringResult { /** * The value for the given key as a string. * * @since 1.3.0 */ value: string; /** * Indicates at which source this value came from. * * Only available for Android and iOS. * * @since 1.3.0 */ source?: GetValueSource;}GetInfoResult
GetInfoResultexport interface GetInfoResult { /** * The Unix timestamp in milliseconds of the last successful fetch, or -1 if no fetch has occurred or initialization is incomplete. * @since 7.5.0 * @example 1762864760 */ lastFetchTime: number; /** * The status of the last fetch attempt. * @since 7.5.0 * @example 1 */ lastFetchStatus: LastFetchStatus;}SetMinimumFetchIntervalOptions
SetMinimumFetchIntervalOptionsexport interface SetMinimumFetchIntervalOptions { /** * Define the maximum age in seconds of an entry in the config cache before it is considered stale. * During development, it's recommended to set a relatively low minimum fetch interval. * * @since 1.3.0 * @default 43200 * @see https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings#remoteconfigsettingsminimumfetchintervalmillis */ minimumFetchIntervalInSeconds: number;}SetSettingsOptions
SetSettingsOptionsexport interface SetSettingsOptions { /** * Defines the maximum amount of milliseconds to wait for a response when fetching configuration from the Remote Config server. * * @since 6.2.0 * @default 60 * @see https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings#remoteconfigsettingsfetchtimeoutmillis */ fetchTimeoutInSeconds?: number; /** * Define the maximum age in seconds of an entry in the config cache before it is considered stale. * During development, it's recommended to set a relatively low minimum fetch interval. * * @since 6.2.0 * @default 43200 * @see https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings#remoteconfigsettingsminimumfetchintervalmillis */ minimumFetchIntervalInSeconds?: number;}AddConfigUpdateListenerOptionsCallback
AddConfigUpdateListenerOptionsCallbackexport type AddConfigUpdateListenerOptionsCallback = ( event: AddConfigUpdateListenerOptionsCallbackEvent | null, error: any,) => void;CallbackId
回调IDexport type CallbackId = string;真实数据来源
真实数据来源本页面是由插件生成的 src/definitions.ts当公共API上游发生变化时,请重新同步。
继续从开始
继续从开始如果您正在使用 开始 规划仪表板和API操作时,请将其连接到 API概述 为实现细节在API概述中 简介 为实现细节在简介中 API密钥 为实现细节在API密钥中 设备 为实现细节在设备中,和 捆绑包 为实现细节在捆绑包中