Richtlinie
Cordova Updater in Cordova verwenden
Verwendung von @capgo/cordova-updater
@capgo/cordova-updater bringt Capgo Live Updates zu Cordova iOS- und Android-Anwendungen mit dem gleichen JavaScript API. @capgo/capacitor-updaterInstallieren Sie das Cordova-Plugin, rufen Sie notifyAppReady() Wie man Cordova Updater in Cordova verwendet @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 });
}
});
Anforderungen an die Plattform
- Cordova Android 13+ und Cordova iOS 7+
- Standard-Cordova-WebView-Schemes (
https://localhost/auf Android,app://localhost/auf iOS) - Vermeide
cordova-plugin-ionic-webview— es verhindert das Austauschen von Paketen
Deploy ein neues Paket
bun run build
bunx @capgo/cli@latest bundle upload --channel=production
Praktische Tipps
- Verwenden Sie denselben Capgo-Anwendungs-ID und Kanälen, wenn Sie auch eine Capacitor- oder Electron-Anwendung verteilen.
- Behandeln Sie native Plugin- oder Cordova-Plattform-Updates wie jede andere native Änderung: Verschicken Sie ein neues Laden-Programm, bevor Sie auf neue native APIs in JavaScript-Paketen angewiesen sind.
- Vollständige Einrichtungsdetails finden Sie in den Dokumentationen zum Cordova-Updater.