Per iniziare
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.
Puoi usare il nostro setup assistito dall'IA per installare il plugin. Aggiungi le skill Capgo al tuo strumento di IA usando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsPoi usa il seguente prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-remote-config` plugin in my project.Se preferisci la configurazione manuale, installa il plugin eseguendo questi comandi e segui le istruzioni specifiche per piattaforma qui sotto:
bun add @capgo/capacitor-firebase-remote-confignpx cap syncImporta
Sezione intitolata “Import”import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';Avvio rapido
Sezione intitolata “Quick start”import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();Esempio: fetchAndActivate
Sezione intitolata “Esempio: fetchAndActivate”import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();Esempio: fetchConfig
Sezione dal titolo “Esempio: fetchConfig”import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();Errori comuni
Sezione intitolata “Errori comuni”- Sync nativo: esegui
npx cap syncdopo gli aggiornamenti dei plugin. - Fonte di verità: fidati
src/definitions.tsnel repo GitHub.
Panoramica API
Sezione intitolata “Panoramica API”activate
Sezione intitolata “activate”Rendi disponibile ai getter l'ultima configurazione recuperata.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();fetchAndActivate
Sezione intitolata “fetchAndActivate”Esegue le operazioni di fetch e attivazione.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();fetchConfig
Sezione intitolata “fetchConfig”Recupera e metti in cache la configurazione dal servizio Remote Config.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();getBoolean
Sezione intitolata “getBoolean”Ottiene il valore della chiave specificata come booleano.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getBoolean({ key: 'key-123' });console.log(result);getNumber
Sezione intitolata “getNumber”Ottiene il valore della chiave specificata come numero.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getNumber({ key: 'key-123' });console.log(result);getString
Sezione intitolata “getString”Ottiene il valore della chiave specificata come stringa.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getString({ key: 'key-123' });console.log(result);getInfo
Sezione intitolata “getInfo”Ottieni informazioni sull'ultima operazione di fetch.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getInfo();console.log(result);setMinimumFetchInterval
Sezione intitolata “setMinimumFetchInterval”Imposta l'intervallo minimo di fetch.
Disponibile solo per il Web.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({ minimumFetchIntervalInSeconds: 43200 });setSettings
Sezione intitolata “setSettings”Imposta le impostazioni della remote config.
Su Android, i valori delle impostazioni vengono persistiti in SharedPreferences.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setSettings({ fetchTimeoutInSeconds: 60, minimumFetchIntervalInSeconds: 43200,});addConfigUpdateListener
Sezione intitolata “addConfigUpdateListener”Aggiungi un listener per l'evento di aggiornamento della config.
Disponibile solo per Android e iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.addConfigUpdateListener((event, error) => { console.log(event);});console.log(result);removeConfigUpdateListener
Sezione intitolata “removeConfigUpdateListener”Rimuovi un listener per l'evento di aggiornamento della config.
Disponibile solo per Android e iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.removeConfigUpdateListener({ id: 'id-123' });Riferimento ai tipi
Sezione: “Type Reference”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 src/definitions.ts. Riesegui la sync quando il API pubblico cambia upstream.
Continua da Getting Started
Sezione intitolata “Continua da Getting Started”Se stai usando Per iniziare per pianificare le operazioni della dashboard e di API, collegalo a Panoramica API per i dettagli di implementazione in Panoramica di API, Introduzione per i dettagli di implementazione in Introduzione, Chiavi API per i dettagli di implementazione delle chiavi API, Dispositivi per i dettagli di implementazione in Devices, e Bundle per il dettaglio di implementazione in Bundles.