Anleitung
Cordova Updater in Cordova nutzen
Mit @capgo/cordova-updater
@capgo/cordova-updater erhält Capgo Live Updates für Cordova iOS- und Android-Apps mit demselben JavaScript API wie @capgo/capacitor-updater. Installiere das Cordova Plugin und rufe notifyAppReady() bei jedem Start und lade Bundles mit @capgo/cli.
Installation
cordova plugin add @capgo/cordova-updater --variable APP_ID=com.example.app
cordova prepare android ios
Basic usage
document.addEventListener('deviceready', async () => {
const { Updater } = cordova.plugins;
await Updater.notifyAppReady();
const { bundle } = await Updater.current();
console.log('Active bundle', bundle);
const latest = await Updater.getLatest();
if (latest.url && !latest.error) {
const downloaded = await Updater.download({
url: latest.url,
version: latest.version,
checksum: latest.checksum,
});
await Updater.next({ id: downloaded.id });
}
});
Plattform-Anforderungen
- Cordova Android 13+ und Cordova iOS 7+
- Standard Cordova WebView-Schemata (
https://localhost/auf Android,app://localhost/auf iOS) - Vermeiden Sie
cordova-plugin-ionic-webview— das verhindert das Bundle-Swapping
Ein neues Bundle deployen
bun run build
bunx @capgo/cli@latest bundle upload --channel=production
Praktische Tipps
- Verwende dieselbe Capgo App-ID und dieselben Channels, falls du auch einen Capacitor oder Electron-Client auslieferst.
- Behandle Upgrades von nativen Plugins oder Cordova-Plattformen wie jede andere native Änderung: Veröffentliche eine neue Store-Binary, bevor du dich auf neue native APIs in JavaScript-Bundles verlässt.
- Alle Details zum Setup findest du in der Cordova-Updater-Docs.