コルダバUpdaterの使い方
インストール
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/cordova-updater`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/cordova-updater/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
このガイドでは、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)
インストール
「インストール」のセクション-
Install the plugin from npm and pass your Capgo app ID:
ターミナル画面 cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
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 -
プラグイン変数を変更した後は、ネイティブ プロジェクトを準備する必要があります:
ターミナル画面 cordova prepare android ios
JavaScriptの使用
「JavaScriptの使用」のセクションその後 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ダウンロードしたバンドルアセットを提供するための
- Cordova iOS 7+で、デフォルトのスキームからウェブビューが提供される必要があります。
app://localhost/バンドル要求をキャッチするための - バンドル要求をキャッチするための
CDVPluginSchemeHandler最初のバンドルをアップロードする
最初のバンドルをアップロードする
Webアセットをビルドし、__CAPGO_KEEP_0__ __CAPGO_KEEP_1__ (同様のワークフローとして__CAPGO_KEEP_2__を使用して)でアップロードしてください。Build your web assets, then upload with the Capgo CLI (same workflow as Capacitor):
bun run buildbunx @capgo/cli@latest bundle upload --channel=production次のステップ
次のステップ- __CAPGO_KEEP_0__ アップデート設定 Capacitor updater configuration 読み
plugin.xmlライブアップデートの互換性 - ネイティブ プラグインの変更を出荷する前に読みます。 Capgoに移行する場合は、同じ__CAPGO_KEEP_1__アプリIDとチャンネルを維持し、クライアント プラグイン パッケージのみが変更されます。 次のステップ
- Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.