Démarrage avec Cordova Updater
Copiez une commande 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 à travers l'ajout de @capgo/cordova-updater à une application Cordova afin de recevoir des mises à jour Capgo en direct sur iOS et Android.
Prerequisites
Section titled “Prerequisites”- Cordova CLI 12+
- Cordova Android 13+ et/ou Cordova iOS 7+
- Un compte Capgo ("Un capgo compte ()
Installation
Section intitulée « Installation »-
Installez le plugin à partir de npm et passez votre Capgo ID d'application :
Fenêtre de terminal cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
Facultatif : définissez des valeurs par défaut à l'installation (mêmes variables que l'Capacitor mise à 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éparez les projets natifs après avoir modifié les variables du plugin :
Fenêtre de terminal cordova prepare android ios
Utilisation JavaScript
Section intitulée « Utilisation JavaScript »Après devicereadycette 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 livrés avec le paquet npm :
import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };Remarques de plateforme
Section intitulée « Remarques de plateforme »- Exige Cordova Android 13+ afin que la vue Web soit servie par défaut.
https://localhost/scheme. - Le plugin s'enregistre un
CordovaPluginPathHandlerpour servir les actifs du bundle téléchargés.
- Exige Cordova iOS 7+ avec le schéma par défaut.
app://localhost/scheme. - pour intercepter les demandes de bundle.
CDVPluginSchemeHandlerTéléchargez votre premier bundle
Sous-titre « Téléchargez votre premier bundle »
Téléchargez votre premier bundleConstruisez vos actifs web, puis téléchargez-les avec le Capgo CLI (même workflow que Capacitor):
bun run buildbunx @capgo/cli@latest bundle upload --channel=productionÉtapes suivantes
Sous-titre « Étapes suivantes »- Comparez les paramètres avec le Capacitor configuration de l'actualiseur — la plupart des options correspondent à
plugin.xmlvariables. - Lisez Live update compatibilité avant l'expédition des modifications du plugin native.
- Migrer vers Capacitor plus tard ? Gardez le même ID d'application Capgo et les canaux ; seule la package du plugin client change.