Cordova 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 to a Cordova app so you can receive Capgo live updates on iOS and Android.
Cordova __CAPGO_KEEP_0__ 12+
protectedTokens- Cordova CLI 12+
- Android 13+ と/または iOS 7+ の Cordova
- A Capgo account (capgo.app/register)
インストール
「インストール」のセクション-
npm からプラグインをインストールし、Capgo アプリ ID を指定してください:
ターミナル画面 cordova plugin add @capgo/cordova-updater --variable APP_ID=YOUR_CAPGO_APP_ID -
オプション: インストール時にデフォルト値を上書きする (同様の変数は Capacitor のアップデーター):
ターミナル画面 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+で、デフォルトのスキームからWebViewが提供される必要があります。
https://localhost/デフォルトのスキーム。 - ダウンロードしたバンドルアセットを提供するために
CordovaPluginPathHandlerCordova iOS 7+で、デフォルトのスキームが必要です。
- バンドル要求をキャッチするために
app://localhost/アップロードする最初のバンドル - セクション “アップロードする最初のバンドル”
CDVPluginSchemeHandlerWebアセットをビルドし、__CAPGO_KEEP_0__ __CAPGO_KEEP_1__ (同様のワークフローとして__CAPGO_KEEP_2__ )でアップロードしてください。
scheme
schemeBuild 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_KEEP_1__ アプリ ID とチャンネルを同じに保ち、クライアント プラグイン パッケージのみを変更する場合は、__CAPGO_KEEP_0__ に移行する必要があります。 コピー
- Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.