Inizia a utilizzare
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo plugin.
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.
Installa
Sezione intitolata “Installa”bun add @capgo/capacitor-firebase-remote-configbunx cap syncImporta
Sezione intitolata “Importa”import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';API Panoramica
Sezione intitolata “API Panoramica”activate
AttivaRendi disponibile la configurazione più recente ai getter.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();fetchAndActivate
Sezione intitolata “fetchAndActivate”Esegui operazioni di fetch e attivazione.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();fetchConfig
Sezione intitolata “fetchConfig”Estrai e memorizza la configurazione dal servizio Remote Config.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();getBoolean
Sezione intitolata “getBoolean”Ottieni il valore per la chiave specificata come booleano.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getBoolean({} as GetBooleanOptions);getNumber
Sezione intitolata “getNumber”Ottieni il valore per la chiave specificata come numero.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getNumber({} as GetNumberOptions);getString
Sezione intitolata “obtieniStringa”Ottieni il valore per la chiave specificata come stringa.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getString({} as GetStringOptions);Ottieni informazioni sull'ultima operazione di fetch.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getInfo();setMinimumFetchInterval
Sezione intitolata “impostaIntervalloMinimoFetch”Imposta l'intervallo di fetch minimo.
Disponibile solo per Web.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({} as SetMinimumFetchIntervalOptions);Imposta le impostazioni di configurazione remote.
Su Android, i valori delle impostazioni vengono persistiti in SharedPreferences.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setSettings({} as SetSettingsOptions);addConfigUpdateListener
Sezione intitolata “aggiungiAscoltatoreAggiornamentoConfig”Aggiungi un ascoltatore per l'evento di aggiornamento della configurazione.
Disponibile solo per Android e iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.addConfigUpdateListener({} as AddConfigUpdateListenerOptionsCallback);removeConfigUpdateListener
Sezione intitolata “rimuoviAscoltatoreAggiornamentoConfig”Rimuovi un ascoltatore per l'evento di aggiornamento della configurazione.
Disponibile solo per Android e iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.removeConfigUpdateListener({} as RemoveConfigUpdateListenerOptions);Riferimento di tipo
Sezione intitolata “Riferimento di tipo”FetchConfigOptions
Sezione intitolata “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
Sezione intitolata “GetBooleanOptions”export type GetBooleanOptions = GetOptions;GetBooleanResult
Sezione intitolata “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
Sezione intitolata “GetNumberOptions”export type GetNumberOptions = GetOptions;GetNumberResult
Sezione intitolata “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;}GetStringOptions
Sezione intitolata “GetStringOptions”export type GetStringOptions = GetOptions;GetStringResult
Sezione intitolata “GetStringResult”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;}GetInfoResult
Sezione intitolata “GetInfoResult”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
Sezione intitolata “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
Sezione intitolata “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
Sezione intitolata “AddConfigUpdateListenerOptionsCallback”export type AddConfigUpdateListenerOptionsCallback = ( event: AddConfigUpdateListenerOptionsCallbackEvent | null, error: any,) => void;CallbackId
Sezione intitolata “CallbackId”export type CallbackId = string;Fonte di Verità
Sezione intitolata “Fonte di Verità”Questa pagina è generata dal plugin’s src/definitions.tsRiepilogo. Riavvia la sincronizzazione quando le informazioni pubbliche API cambiano nell'area upstream.