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_KEEP_0__を追加する方法について説明します。 @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.
includes install, sync, and the source markdown guide.
This guide walks you through adding __CAPGO_KEEP_0__ to a Cordova app so you can receive live updates on iOS and Android.- Cordova CLI 12+
- コルダバ Android 13+ と/またはコルダバ iOS 7+
- A Capgo account (capgo.app/register)
インストール
「インストール」のセクション-
npm からプラグインをインストールし、Capgo アプリ 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、プラグインは__CAPGO_KEEP_0__パッケージとともに利用可能です 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/デフォルトのスキームから提供されるウェブビューは、scheme. - ダウンロードしたバンドルアセットを提供するための
CordovaPluginPathHandlerCordova iOS 7+が必要です。デフォルトの
- デフォルトのスキームから提供されるウェブビューは、scheme.
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_KEEP_1__ アプリ ID とチャンネルを同じに保ち、クライアント プラグイン パッケージのみを変更します。 __CAPGO_KEEP_0__
- Migrating to Capacitor later? Keep the same Capgo app ID and channels; only the client plugin package changes.