Capacitor UpdaterのGetting Started
このプラグインのインストール手順とフルマークダウンガイドをコピーします。
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でリアルタイム更新を受けるために @capgo/cordova-updater to a Cordova app so you can receive Capgo live updates on iOS and Android.
「前提条件」のセクション
Cordova __CAPGO_KEEP_0__ 12+- Cordova CLI 12+
- アカウント (
- Capgo.app/registercapgo.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 -
オプション: インストール時にデフォルト値を上書きする (同様の変数は 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/プラグインはダウンロードしたバンドル アセットを提供するために、 - Cordova iOS 7+ を使用する必要があり、デフォルトのスキームから提供します。
CordovaPluginPathHandlerダウンロードしたバンドル アセットを提供するために
- デフォルトのスキームから
app://localhost/スキーム。 - プラグインは
CDVPluginSchemeHandlerをキャッチするために
最初のバンドルをアップロードしてください
タイトル:最初のバンドルをアップロードしてくださいCapgoとCLIを使用して、Capacitorと同じワークフローで、Webアセットをビルドし、CapgoとCLIをアップロードしてください。
bun run buildbunx @capgo/cli@latest bundle upload --channel=production