Erste Schritte
Kopiere einen Setup-Prompt mit den Installationsschritten und dem vollständigen Markdown-Guide für dieses Plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-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/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.
Installation
Abschnitt mit dem Titel „Installation“Du kannst unser KI-gestütztes Setup nutzen, um das Plugin zu installieren. Füge die Capgo Skills mit dem folgenden Befehl deinem KI-Tool hinzu:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsNutze dann diesen Prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-updater` plugin in my project.Wenn du ein manuelles Setup bevorzugst, installiere das Plugin mit den folgenden Befehlen und befolge die plattformspezifischen Anweisungen unten:
bun add @capgo/capacitor-updaterbunx cap syncyarn add @capgo/capacitor-updaterbunx cap syncpnpm add @capgo/capacitor-updaterbunx cap syncbun add @capgo/capacitor-updaterbunx cap syncSchnellstart
Abschnitt mit dem Titel „Schnellstart“Für die meisten Nutzer empfehlen wir den Haupt-Quickstart-Guide der sowohl die Plugin-Installation als auch die Capgo Cloud-Integration abdeckt.
Dieser Getting-started-Guide konzentriert sich auf die technischen Plugin-Details für fortgeschrittene Nutzer, die die zugrunde liegenden Mechanismen verstehen oder Self-hosted Updates umsetzen möchten.
Übersicht
Abschnitt: „Übersicht“Das Capacitor Updater Plugin ermöglicht Over-the-Air (OTA) Updates für deine Capacitor Apps. So kannst du Updates direkt pushen, ohne den Review-Prozess der App Stores abzuwarten.
So funktioniert es
Abschnitt „So funktioniert es“- Bundle-Download: Das Plugin lädt Update-Bundles herunter (ZIP-Dateien mit deinen Web-Assets)
- Entpacken: Die Bundles werden im lokalen Speicher des Geräts entpackt
- Hot Reload: Die App wechselt zum neuen Bundle, ohne dass ein Neustart nötig ist
- Fallback: Schlägt ein Update fehl, kehrt die App zur letzten funktionierenden Version zurück
Nutzungsmodi
Abschnitt mit dem Titel „Nutzungsmodi“1. Auto-Update-Modus (Empfohlen)
Abschnitt mit dem Titel „1. Auto-Update-Modus (Empfohlen)“Der einfachste Weg, das Plugin mit automatischem Update-Management zu nutzen:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Plugin handles everything automatically// Configure in capacitor.config.tsAdd to your capacitor.config.ts:
{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-update-server.com/api/updates' } }}2. Manueller Modus
Abschnitt mit dem Titel „2. Manueller Modus“Für erweiterte Kontrolle über den Update-Prozess:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Download an updateconst bundle = await CapacitorUpdater.download({ url: 'https://your-server.com/updates/v1.0.1.zip', version: '1.0.1'});
// Set the bundle (will be used on next app start)await CapacitorUpdater.set({ id: bundle.id});
// Or reload immediatelyawait CapacitorUpdater.reload();Plattformkonfiguration
Abschnitt mit dem Titel „Plattformkonfiguration“Keine weitere Konfiguration erforderlich. Das Plugin funktioniert sofort.
Keine weitere Konfiguration erforderlich. Das Plugin funktioniert sofort.
Grundlegende API Nutzung
Abschnitt mit dem Titel „Grundlegende Nutzung von API“Update herunterladen
Abschnitt „Update herunterladen“import { CapacitorUpdater } from '@capgo/capacitor-updater';
const bundle = await CapacitorUpdater.download({ url: 'https://example.com/update.zip', version: '1.0.1'});
console.log('Downloaded bundle:', bundle.id);Aktives Bundle festlegen
Abschnitt „Aktives Bundle festlegen“// Set bundle to be used on next app startawait CapacitorUpdater.set({ id: bundle.id});Mit neuem Bundle neu laden
Abschnitt „Mit neuem Bundle neu laden“// Reload app immediately with new bundleawait CapacitorUpdater.reload();Bundles auflisten
Abschnitt „Bundles auflisten“const { bundles } = await CapacitorUpdater.list();console.log('Available bundles:', bundles);Bundle löschen
Abschnitt „Bundle löschen“await CapacitorUpdater.delete({ id: 'bundle-id'});Aktuelles Bundle abrufen
Abschnitt „Aktuelles Bundle abrufen“const { bundle } = await CapacitorUpdater.current();console.log('Current bundle:', bundle.version);Event Listener
Abschnitt „Event Listener“Auf Update-Events hören:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Listen for download progressCapacitorUpdater.addListener('download', (info) => { console.log('Download progress:', info.percent);});
// Listen for download completionCapacitorUpdater.addListener('downloadComplete', (bundle) => { console.log('Download complete:', bundle.version);});
// Listen for update failuresCapacitorUpdater.addListener('updateFailed', (error) => { console.error('Update failed:', error);});
// Listen for successful updatesCapacitorUpdater.addListener('updateAvailable', (info) => { console.log('Update available:', info.version);});Konfigurationsoptionen
Abschnitt mit dem Titel „Konfigurationsoptionen“Konfiguriere das Plugin in deinem capacitor.config.ts:
{ plugins: { CapacitorUpdater: { // Auto-update settings autoUpdate: 'atBackground', updateUrl: 'https://api.example.com/updates',
// Update behavior resetWhenUpdate: true,
// Version settings version: '1.0.0',
// Security allowModifyUrl: false,
// Stats collection statsUrl: 'https://api.example.com/stats',
// Channel (for Capgo cloud) defaultChannel: 'production' } }}Integrationsmuster
Abschnitt „Integration Patterns“Mit Capgo Cloud
Abschnitt „Mit Capgo Cloud“Der einfachste Einstieg:
// Install the Capgo CLIbun add -g @capgo/cli
// Login to Capgonpx @capgo/cli login
// Upload your first bundlenpx @capgo/cli bundle upload
// The plugin auto-updates from Capgo cloudSiehe den Haupt-Quickstart-Guide für Details.
Self-Hosted Updates
Abschnitt „Self-Hosted Updates“Hoste deinen eigenen Update-Server:
// Configure your update endpoint{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-server.com/api/check-update' } }}Dein Server sollte Folgendes zurückgeben:
{ "version": "1.0.1", "url": "https://your-server.com/updates/1.0.1.zip"}Siehe Self-Hosted-Modus für alle Details.
Manueller Update-Flow
Abschnitt „Manueller Update-Flow“Volle Kontrolle über Updates:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
async function checkAndUpdate() { // Check for updates from your server const response = await fetch('https://api.example.com/check-update'); const { version, url } = await response.json();
// Download the update const bundle = await CapacitorUpdater.download({ url, version });
// Notify bundle is ready await CapacitorUpdater.notifyAppReady();
// Set as next version await CapacitorUpdater.set({ id: bundle.id });
// Reload when ready await CapacitorUpdater.reload();}Best Practices
Abschnitt mit dem Titel „Best Practices“- Immer aufrufen
notifyAppReady()wenn deine App erfolgreich lädt - Updates gründlich testen, bevor du sie nach Production pushst
- Fehlerbehandlung für Netzwerkfehler implementieren
- Versionsnummern konsistent verwenden
- Bundle-Größen klein halten für schnellere Downloads
- Erfolgsraten der Updates überwachen
Nächste Schritte
Abschnitt „Nächste Schritte“- Plugin API Referenz - API Dokumentation abschließen
- Plugin-Einstellungen - Alle Konfigurationsoptionen
- Events - Verfügbare Update-Events
- Self-Hosted Modus - Eigener Update-Server
- Lokale Entwicklung - Updates lokal testen
- Debugging - Troubleshooting-Guide
- Bekannte Probleme - Häufige Probleme und Lösungen
- GitHub Diskussionen - Community-Support
- Discord - Echtzeit-Chat
Weiter geht's nach Getting Started
Abschnitt: „Weiter geht’s mit Getting Started“Wenn du es nutzt Erste Schritte Um die Arbeit an nativen Plugins zu planen, verbinde sie mit Verwendung von @capgo/capacitor-updater für die native Funktion in der Verwendung von @capgo/capacitor-updater, Capgo Plugin-Verzeichnis für den Produkt-Workflow im Capgo Plugin-Verzeichnis, Capacitor Plugins von Capgo für das Implementierungsdetail in Capacitor Plugins von Capgo, Plugins hinzufügen oder aktualisieren für das Implementierungsdetail beim Hinzufügen oder Aktualisieren von Plugins, und Ionic Enterprise Plugin-Alternativen für den Produkt-Workflow bei den Ionic Enterprise Plugin-Alternativen.