Prise en main
Copiez un prompt de configuration incluant les étapes d'installation et le guide markdown complet pour ce 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.
Installer
Section intitulée « Installation »Vous pouvez utiliser notre configuration assistée par IA pour installer le plugin. Ajoutez les skills Capgo à votre outil d'IA avec la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsUtilisez ensuite le prompt suivant :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-remote-config` plugin in my project.Si vous préférez une installation manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à chaque plateforme ci-dessous :
bun add @capgo/capacitor-firebase-remote-confignpx cap syncImporter
Section intitulée « Import »import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';Démarrage rapide
Section intitulée « Démarrage rapide »import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();Exemple : fetchAndActivate
Section intitulée « Exemple : fetchAndActivate »import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();Exemple : fetchConfig
Section intitulée « Exemple : fetchConfig »import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();Erreurs courantes
Section intitulée « Erreurs courantes »- Sync native : exécuter
npx cap syncaprès les mises à jour du plugin. - Source de vérité : fiez-vous
src/definitions.tsau repo GitHub.
Aperçu de API
Section intitulée « Aperçu API »activate
Section intitulée « activer »Rendre la dernière configuration récupérée disponible pour les getters.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.activate();fetchAndActivate
Section intitulée « fetchAndActivate »Exécuter les opérations de récupération et d'activation.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchAndActivate();fetchConfig
Section intitulée « fetchConfig »Récupérer et mettre en cache la configuration depuis le service Remote Config.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.fetchConfig();getBoolean
Section intitulée « getBoolean »Récupérer la valeur de la clé donnée sous forme de booléen.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getBoolean({ key: 'key-123' });console.log(result);getNumber
Section intitulée « getNumber »Récupérer la valeur de la clé donnée sous forme de nombre.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getNumber({ key: 'key-123' });console.log(result);getString
Section intitulée « getString »Récupérez la valeur de la clé donnée sous forme de chaîne.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getString({ key: 'key-123' });console.log(result);Récupère des informations sur la dernière opération de récupération.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.getInfo();console.log(result);setMinimumFetchInterval
Section intitulée « setMinimumFetchInterval »Définir l'intervalle de récupération minimum.
Disponible uniquement pour le Web.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setMinimumFetchInterval({ minimumFetchIntervalInSeconds: 43200 });setSettings
Section intitulée « setSettings »Définissez les paramètres de la config distante.
Sur Android, les valeurs des paramètres sont persistées dans SharedPreferences.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.setSettings({ fetchTimeoutInSeconds: 60, minimumFetchIntervalInSeconds: 43200,});addConfigUpdateListener
Section intitulée « addConfigUpdateListener »Add a listener for the config update event.
Disponible uniquement pour Android et iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
const result = await FirebaseRemoteConfig.addConfigUpdateListener((event, error) => { console.log(event);});console.log(result);removeConfigUpdateListener
Section intitulée « removeConfigUpdateListener »Supprimez un listener pour l'événement de mise à jour de la config.
Disponible uniquement pour Android et iOS.
import { FirebaseRemoteConfig } from '@capgo/capacitor-firebase-remote-config';
await FirebaseRemoteConfig.removeConfigUpdateListener({ id: 'id-123' });Référence de type
Section intitulée « Référence de type »FetchConfigOptions
Section intitulée « 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
Section intitulée « GetBooleanOptions »export type GetBooleanOptions = GetOptions;GetBooleanResult
Section intitulée « 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
Section intitulée « GetNumberOptions »export type GetNumberOptions = GetOptions;GetNumberResult
Section intitulée « 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
Section intitulée « GetStringOptions »export type GetStringOptions = GetOptions;GetStringResult
Section intitulée « 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
Section intitulée « 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
Section intitulée « 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
Section intitulée « 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
Section intitulée « AddConfigUpdateListenerOptionsCallback »export type AddConfigUpdateListenerOptionsCallback = ( event: AddConfigUpdateListenerOptionsCallbackEvent | null, error: any,) => void;CallbackId
Section intitulée « CallbackId »export type CallbackId = string;Source de vérité
Section intitulée « Source de vérité »Cette page est générée à partir de src/definitions.ts. Relancez la synchronisation lorsque l’API public change en amont.
Continuer depuis Getting Started
Section intitulée « Continuer après Prise en main »Si vous utilisez Prise en main pour planifier les opérations du dashboard et de API, connectez-l’avec Aperçu de API pour les détails d'implémentation dans « Vue d'ensemble de API », Introduction pour les détails d'implémentation dans l'introduction, Clés API pour les détails d'implémentation dans API Keys, Appareils pour les détails d'implémentation dans Devices, et Les bundles pour les détails d'implémentation dans Bundles.