Einführung in Cordova Updater
Kopieren Sie einen Einrichtungsvorschlag mit den Installationsanweisungen und der vollständigen Markdown-Anleitung für diesen 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.
Diese Anleitung führt Sie durch die Hinzufügung von @capgo/cordova-updater zu einer Cordova-Anwendung, damit Sie Capgo live Updates auf iOS und Android erhalten können.
Abschnitt mit dem Titel „Voraussetzungen“
Cordova __CAPGO_KEEP_0__ 12+- 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-Verwendung
Abschnitt mit dem Titel „JavaScript-Verwendung“Nachdem deviceready, der Plugin ist 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 im Paket npm 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 geladen wird. - Registriert ein
CordovaPluginPathHandlerum heruntergeladene Bundle-Assets zu dienen.
- 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, laden Sie dann mit den Capgo CLI hoch (gleiches Workflow wie Capacitor):
bun run buildbunx @capgo/cli@latest bundle upload --channel=productionNächste Schritte
Abschnitt mit dem Titel "Nächste Schritte"- __CAPGO_KEEP_0__-Updater-Konfiguration Capacitor updater configuration Lesen
plugin.xmlLive-Update-Kompatibilität - Bevor Sie native Plugin-Änderungen in den Vertrieb bringen. Zum Migrieren zu __CAPGO_KEEP_0__ später? 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.