ガイド
Cordova UpdaterをCordovaで使用する方法
@capgo/cordova-updaterを使用すると
@capgo/cordova-updater brings Capgo live updates to Cordova iOS and Android apps with the same JavaScript API as @capgo/capacitor-updaterCordova プラグインをインストールし、 notifyAppReady() 起動毎に呼び出し、バンドルをアップロードしてください。 @capgo/cli.
インストール
cordova plugin add @capgo/cordova-updater --variable APP_ID=com.example.app
cordova prepare android ios
基本的な使用方法
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 });
}
});
プラットフォームの要件
- コルダバAndroid 13+ および Cordova iOS 7+
- デフォルトの Cordova WebView スキーム (
https://localhost/Android の場合、app://localhost/iOS の場合) - 避ける
cordova-plugin-ionic-webview— それはバンドル交換を防ぎます
新しいバンドルを展開
bun run build
bunx @capgo/cli@latest bundle upload --channel=production
実践的なアドバイス
- 同じCapgoアプリIDとチャンネルを再利用する場合は、CapacitorまたはElectronクライアントも配信する。
- ネイティブプラグインまたはコルダバプラットフォームのアップグレードは、ネイティブAPIをJavaScriptバンドルで使用する前に、新しいストアバイナリを配信するように扱ってください。
- 詳細は コルダバアップデートドキュメント.