Erste Schritte mit Cordova Updater
Einen Setup-Vorschlag mit den Installationsanweisungen und der vollständigen Markdown-Dokumentation für diesen Plugin kopieren.
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.
Diese Anleitung führt Sie durch das Hinzufügen von @capgo/cordova-updater zu einer Cordova-Anwendung, damit Sie auf iOS und Android Capgo live Updates erhalten können.
Voraussetzungen
Abschnitt mit dem Titel „Voraussetzungen“- Cordova CLI 12+
- Cordova Android 13+ und/oder Cordova iOS 7+
- Ein Capgo-Konto (capgo.app/register)
Installation
Abschnitt mit dem Titel “Installation”-
Installieren Sie das Plugin von npm und geben Sie Ihre Capgo-App-ID ein:
Terminal-Fenster cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
Optional: Überschreiben Sie die Standards bei der Installation (gleiche Variablen wie der Capacitor-Updater):
Terminal-Fenster 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 -
Vorbereiten Sie native Projekte nachdem Sie Plugin-Variablen geändert haben:
Terminalfenster cordova prepare android ios
JavaScript-Anwendung
Abschnitt mit dem Titel „JavaScript-Anwendung“Nachdem deviceready, ist der Plugin verfügbar als 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 }); }});TypScript-Typen liegen mit dem npm-Paket vor:
import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };Plattformhinweise
Abschnitt mit dem Titel „Plattformhinweise“- Benötigt Cordova Android 13+, sodass das WebView aus dem Standard-
https://localhost/scheme. - Registriert ein
CordovaPluginPathHandlerum heruntergeladene Bundle-Assets zu servieren.
- Benötigt Cordova iOS 7+ mit dem Standard-
app://localhost/scheme. - Implementiert ein
CDVPluginSchemeHandlerum Bundle-Anfragen abzufangen.
Hochladen Ihres ersten Bundles
Abschnitt mit dem Titel “Hochladen Ihres ersten Bundles”Bauen Sie Ihre Web-Assets, dann laden Sie sie mit dem Capgo CLI (gleiches Workflow wie Capacitor):
bun run buildbunx @capgo/cli@latest bundle upload --channel=productionNächste Schritte
Abschnitt mit dem Titel "Nächste Schritte"- Einstellungen mit dem __CAPGO_KEEP_0__ Updater konfigurieren Capacitor updater configuration Lesen
plugin.xmlLive-Update-Kompatibilität - bevor man native Plugin-Änderungen verschickt. Zu __CAPGO_KEEP_0__ migrieren? Halten Sie die gleiche __CAPGO_KEEP_1__-Anwendungs-ID und Kanäle bei; nur der Client-Plugin-Paket ändert sich. Migrating to __CAPGO_KEEP_0__ later? Keep the same __CAPGO_KEEP_1__ app ID and channels; only the client plugin package changes.
- Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.