跳过内容

Getting Started

GitHub

您可以使用我们的AI辅助设置来安装插件。将以下命令添加到您的AI工具中:Capgo

终端窗口
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-config
bunx cap sync
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';

activate

激活

使最后获取的配置可供获取者使用。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();

fetchAndActivate

获取和激活

执行获取和激活操作。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();

fetchConfig

获取配置

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

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();

getBoolean

获取布尔值

以布尔值获取给定键的值。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getBoolean({} as GetBooleanOptions);

获取指定键的值作为数字。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getNumber({} as GetNumberOptions);

获取指定键的值作为字符串。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getString({} as GetStringOptions);

获取最后一次 fetch 操作的信息。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getInfo();

设置最小 fetch interval。

仅适用于 Web。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({} as SetMinimumFetchIntervalOptions);

设置远程配置设置。

在 Android 上,设置值将保存在 SharedPreferences 中。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setSettings({} as SetSettingsOptions);

添加配置更新事件的监听器。

仅适用于 Android 和 iOS。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.addConfigUpdateListener({} as AddConfigUpdateListenerOptionsCallback);

removeConfigUpdateListener

标题:移除配置更新监听器

移除配置更新事件的监听器。

仅适用于 Android 和 iOS。

import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.removeConfigUpdateListener({} as RemoveConfigUpdateListenerOptions);

类型参考

类型参考部分

FetchConfigOptions

FetchConfigOptions部分
export 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

GetBooleanOptions部分
export type GetBooleanOptions = GetOptions;

GetBooleanResult

GetBooleanResult部分
export 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

GetNumberOptions部分
export type GetNumberOptions = GetOptions;

GetNumberResult

GetNumberResult部分
export 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;
}
export type GetStringOptions = GetOptions;
export 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;
}
export 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

SetMinimumFetchIntervalOptions的标题
export 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

SetSettingsOptions的标题
export 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

AddConfigUpdateListenerOptionsCallback的标题
export type AddConfigUpdateListenerOptionsCallback = (
event: AddConfigUpdateListenerOptionsCallbackEvent | null,
error: any,
) => void;

CallbackId

回调ID
export type CallbackId = string;

真实来源

真实来源

本页面由插件生成 src/definitions.ts当公共API上游更改时,重新运行同步。

从开始行动

从开始行动

如果您正在使用 开始行动 规划仪表板和API操作,连接它 API 介绍 对于 API 介绍的实现细节 简介 对于简介的实现细节 API 密钥 对于 API 密钥的实现细节 设备 对于设备的实现细节, 和 捆绑包 对于捆绑包的实现细节。