Iniziare
Copia una richiesta 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.
Installazione
Sezione intitolata “Installazione”Puoi utilizzare la nostra configurazione assistita dall'IA per installare il plugin. Aggiungi le Capgo abilità al tuo strumento di IA utilizzando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsUsa poi la seguente richiesta:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-remote-config` plugin in my project.Se preferisci l'installazione manuale, installa il plugin eseguendo i seguenti comandi e segui le istruzioni specifiche per la piattaforma riportate di seguito:
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
Sezione intitolata “attiva”Fai disponibile la configurazione più recente raccolta per i 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 “getString”Ottieni il valore per la chiave specificata come stringa.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getString({} as GetStringOptions);getInfo
Sezione intitolata “getInfo”Ottieni informazioni sull'ultima operazione di fetch.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.getInfo();setMinimumFetchInterval
Sezione intitolata “setMinimumFetchInterval”Imposta l'intervallo di fetch minimo.
Disponibile solo per Web.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({} as SetMinimumFetchIntervalOptions);setSettings
Sezione intitolata “setSettings”Imposta le impostazioni della configurazione remota.
Sui dispositivi 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 “addConfigUpdateListener”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 “removeConfigUpdateListener”Elimina 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
Riferimento di tipoFetchConfigOptions
Sezione intitolata “Riferimento di tipo”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 “Opzioni di FetchConfig”export type GetBooleanOptions = GetOptions;GetBooleanResult
Sezione intitolata “Opzioni di GetBoolean”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 “Risultato di GetBoolean”export type GetNumberOptions = GetOptions;GetNumberResult
Sezione intitolata “Opzioni di GetNumber”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.ts. Riavvia la sincronizzazione quando il pubblico API cambia upstream.
Continua da Getting Started
Sezione intitolata “Continua da Getting Started”Se stai utilizzando Getting Started per pianificare dashboard e API operazioni, connettilo con API Overview per i dettagli di implementazione in API Overview, Introduzione per i dettagli di implementazione in Introduzione, API Chiavi per i dettagli di implementazione in API Chiavi, Dispositivi per i dettagli di implementazione in Dispositivi, e Bundle per i dettagli di implementazione in Bundle.