Prise en main de Cordova Updater
Prêt à coller
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 @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.
ce plugin. Ionic WebView contourne les gestionnaires de schéma de Cordova, donc les ensembles téléchargés ne s'ouvriront pas.
Prérequis- Cordova CLI 12+
- Android Cordova 13+ et/ou iOS Cordova 7+
- Un compte Capgo (capgo.app/register)
Installation
Section intitulée “Installation”-
Installez le plugin à partir de npm et passez votre ID d'application Capgo:
Fenêtre de terminal cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
Facultatif : surcharger les valeurs par défaut lors de l'installation (mêmes variables que l'Capacitor updater) :
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 de JavaScript
Section intitulée « Utilisation de JavaScript »Après devicereadypuis, le 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 package npm :
import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };Remarques sur les plateformes
Section intitulée « Remarques sur les plateformes »- Exige Cordova Android 13+ afin que la vue Web soit servie par défaut
https://localhost/scheme. - Le plugin enregistre un
CordovaPluginPathHandlerpour servir les actifs de bundle téléchargés.
- Exige Cordova iOS 7+ avec le schéma par défaut
app://localhost/scheme. - Le plugin implémente
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
Étapes suivantes- Section intitulée « Étapes suivantes » Capacitor updater configuration __CAPGO_KEEP_0__ configuration de mise à jour
plugin.xml— la plupart des options correspondent à - variables. Lire Compatibilité de mise à jour en temps réel
- Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.