Démarrage avec Cordova Updater
Copiez un prompt de configuration avec les étapes d'installation et la 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/cordova-updater`
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/cordova-updater/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.
Ce guide vous guide pour ajouter @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.
Section intitulée “Prérequis”
Cordova __CAPGO_KEEP_0__ 12+- Cordova CLI 12+
- Un compte __CAPGO_KEEP_0__ (
- Capgo.app/registercapgo.app/register)
Section intitulée “Installation”
Installez le plugin à partir de __CAPGO_KEEP_0__ et passez votre ID d'application __CAPGO_KEEP_1__ :-
Install the plugin from npm and pass your Capgo app ID:
Fenêtre de terminal cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
Facultatif : définir des valeurs par défaut à l'installation (même variables que l'Capacitor mis à jour) :
Fenêtre de terminal cordova plugin add @capgo/cordova-updater \--variable APP_ID=YOUR_CAPGO_APP_ID \--variable DEFAULT_CHANNEL=production \--variable UPDATE_URL=https://plugin.capgo.app/updates \--variable AUTO_UPDATE=atBackground -
Préparer les projets natifs après avoir modifié les variables du plugin :
Fenêtre de terminal cordova prepare android ios
Utilisation du JavaScript
Section intitulée “Utilisation du JavaScript”Après, devicereadyle plugin est disponible sous la forme de cordova.plugins.Updater:
document.addEventListener('deviceready', async () => { const { Updater } = cordova.plugins;
await Updater.notifyAppReady();
const latest = await Updater.getLatest(); if (latest.url && !latest.error) { const bundle = await Updater.download({ url: latest.url, version: latest.version, checksum: latest.checksum, });
await Updater.next({ id: bundle.id }); }});Les types TypeScript sont fournis avec le package npm :
import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };Notes de plateforme
Section intitulée “Notes de plateforme”- Exige Cordova Android 13+ afin que le WebView soit servi à partir du schéma par défaut.
https://localhost/Le plugin s'enregistre un - pour servir les actifs de bundle téléchargés.
CordovaPluginPathHandlerExige Cordova iOS 7+ avec le schéma par défaut
- Exige Cordova iOS 7+ avec le schéma par défaut
app://localhost/schéma. - Le plugin met en œuvre
CDVPluginSchemeHandlerpour intercepter les demandes de bundle.
Téléchargez votre premier bundle
Section intitulée “Téléchargez votre premier bundle”Construisez vos actifs web, puis téléchargez avec le Capgo CLI (même workflow que Capacitor):
bun run buildbunx @capgo/cli@latest bundle upload --channel=productionÉtapes suivantes
Section intitulée “Étapes suivantes”- Comparer les paramètres avec la configuration de mise à jour Capacitor — la plupart des options sont mappées à
plugin.xmlles variables. - Lire Compatibilité de mise à jour en temps réel Avant de livrer les modifications du plugin native.
- Migrer vers Capacitor plus tard ? Conservez le même Capgo ID d'application et les canaux ; seule la package du plugin client change.