コルダバ アップデーター

コルダバUpdaterの使い方

GitHub

このガイドでは、iOSおよびAndroid向けにライブアップデートを受け取ることができるCordovaアプリに @capgo/cordova-updater Capgoを追加する方法について説明します。

Cordova __CAPGO_KEEP_0__ 12+

protectedTokens
  • Cordova CLI 12+
  • Cordova Android 13+ と/または Cordova iOS 7+
  • A Capgo account (capgo.app/register)
  1. Install the plugin from npm and pass your Capgo app ID:

    ターミナル画面
    cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID
  2. Optional: override defaults at install time (same variables as the Capacitor updater):

    ターミナル画面
    cordova plugin add @capgo/cordova-updater \
    --variable APP_ID=YOUR_CAPGO_APP_ID \
    --variable DEFAULT_CHANNEL=production \
    --variable UPDATE_URL=https://plugin.capgo.app/updates \
    --variable AUTO_UPDATE=atBackground
  3. プラグイン変数を変更した後は、ネイティブ プロジェクトを準備する必要があります:

    ターミナル画面
    cordova prepare android ios

その後 deviceready、プラグインは cordova.plugins.Updater:

document.addEventListener('deviceready', async () => {
const { Updater } = cordova.plugins;
await Updater.notifyAppReady();
const latest = await Updater.getLatest();
if (latest.url && !latest.error) {
const bundle = await Updater.download({
url: latest.url,
version: latest.version,
checksum: latest.checksum,
});
await Updater.next({ id: bundle.id });
}
});

npmパッケージに付属するTypeScriptの型

import type { UpdaterPlugin } from '@capgo/cordova-updater';
declare const cordova: { plugins: { Updater: UpdaterPlugin } };
  • Cordova Android 13+で、デフォルトのスキームからウェブビューが提供される必要があります。 https://localhost/ デフォルトのスキームからウェブビューが提供される必要があります。
  • ダウンロードしたバンドルアセットを提供するための CordovaPluginPathHandler ダウンロードしたバンドルアセットを提供するための

Build your web assets, then upload with the Capgo CLI (same workflow as Capacitor):

ターミナル画面
bun run build
bunx @capgo/cli@latest bundle upload --channel=production

次のステップ

次のステップ