Anleitung
So verwendest du Cordova Updater in Cordova
Verwendung von @capgo/cordova-updater
@capgo/cordova-updater bringt Capgo Live Updates in Cordova iOS- und Android-Apps mit demselben JavaScript API wie @capgo/capacitor-updater. Installiere das Cordova-Plugin, rufe notifyAppReady() bei jedem Start auf 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 });
}
});
Plattformanforderungen
- Cordova Android 13+ und Cordova iOS 7+
- Standard-Cordova-WebView-Schemes (
https://localhost/auf Android,app://localhost/auf iOS) - Vermeide
cordova-plugin-ionic-webview— verhindert das Bundle-Swapping
Neues Bundle deployen
bun run build
bunx @capgo/cli@latest bundle upload --channel=production
Praxis-Tipps
- Nutze dieselbe Capgo App-ID und dieselben Kanäle, wenn du auch einen Capacitor- oder Electron-Client auslieferst.
- Behandle native Plugin- oder Cordova-Plattform-Upgrades wie jede andere native Änderung: Liefere ein neues Store-Binary aus, bevor du neue native APIs in JavaScript-Bundles nutzt.
- Alle Details zur Einrichtung findest du in der Cordova-Updater-Docs.